stride3d/stride · error · NotImplementedException

Exception of type 'System.NotImplementedException' was…

Error message

Exception of type 'System.NotImplementedException' was thrown.

What it means

ParameterParsers.Match is a stub: the struct implements IParser<ParameterListNode> but its Match method immediately throws NotImplementedException. Any code path that routes shader-parameter parsing through this parser can never succeed — the feature is simply not implemented yet.

Solutions

  1. Use the implemented static helpers instead (ParameterParsers.Declarations / ParameterParsers.Values), which delegate to ParameterDeclarationsParser
  2. Implement Match in ParameterParsers (likely by delegating to the same ParameterDeclarationsParser/expression-list parsers)
  3. Avoid the unimplemented parser path until the library ships an implementation

Example fix

// before
public bool Match<TScanner>(...) => throw new NotImplementedException();
// after
public bool Match<TScanner>(ref TScanner scanner, ParseResult result, [MaybeNullWhen(false)] out ParameterListNode parsed, in ParseError? orError = null)
    where TScanner : struct, IScanner
    => Declarations(ref scanner, result, out var decls, in orError) && Assign(decls, out parsed);
Defensive patterns

Strategy: fallback

Validate before calling

var parserType = typeof(ParameterParsers);
bool matchImplemented = parserType.GetMethod("Match")!.GetMethodImpl("Match", 0, BindingFlags.Public|BindingFlags.Instance, null, null) is { DeclaringType: var d } && !d.Name.Contains("NotImplemented");

Type guard

bool CanParseParameters = false; // static fact: ParameterParsers.Match is a stub; never call it in current builds

Try / catch

try { ok = ParameterParsers.Match(ref scanner, result, out parsed, orError); }
catch (NotImplementedException) { ok = ParameterParsers.Declarations(ref scanner, result, out var decls, in orError); parsed = MapToListNode(decls); }

Prevention

When it happens

Trigger: Calling ParameterParsers.Match directly, or any composition that selects this parser for parsing a shader parameter list (e.g. parsing a pass/ shader signature that expects a ParameterListNode).

Common situations: Using an experimental/incomplete SDSL parser API where the parameter-list parser was scaffolded (record struct with delegating static helpers) but the main Match was never filled in.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/928acf6fdc6d19af. Report an issue: GitHub.

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Parsers/Parsing/SDSL/Parsers/ShaderParsers/ShaderParameters.cs:11

using System.Diagnostics.CodeAnalysis;
using Stride.Shaders.Parsing.SDSL.AST;

namespace Stride.Shaders.Parsing.SDSL;


public record struct ParameterParsers : IParser<ParameterListNode>
{
    public bool Match<TScanner>(ref TScanner scanner, ParseResult result, [MaybeNullWhen(false)] out ParameterListNode parsed, in ParseError? orError = null) where TScanner : struct, IScanner
    {
        throw new NotImplementedException();
    }
    public static bool Declarations<TScanner>(ref TScanner scanner, ParseResult result, [MaybeNullWhen(false)] out ShaderParameterDeclarations parsed, in ParseError? orError = null)
        where TScanner : struct, IScanner
        => new ParameterDeclarationsParser().Match(ref scanner, result, out parsed, in orError);
    public static bool Values<TScanner>(ref TScanner scanner, ParseResult result, out ShaderExpressionList parsed, in ParseError? orError = null)
        where TScanner : struct, IScanner
        => new ParameterListParser().Match(ref scanner, result, out parsed, in orError);

    public static bool GenericsList<TScanner>(ref TScanner scanner, ParseResult result, [MaybeNullWhen(false)] out ShaderExpressionList parsed, in ParseError? orError = null)
        where TScanner : struct, IScanner
        => new GenericsListParser().Match(ref scanner, result, out parsed, in orError);
    public static bool GenericsValue<TScanner>(ref TScanner scanner, ParseResult result, [MaybeNullWhen(false)] out Expression parsed, in ParseError? orError = null)
        where TScanner : struct, IScanner
        => new GenericsValueParser().Match(ref scanner, result, out parsed, in orError);
}


public record struct ParameterDeclarationsParser : IParser<ShaderParameterDeclarations>

View on GitHub (pinned to 96fad776d2)