dotnet/efcore · error · NotImplementedException
Non-extension static method not supported
Error message
Non-extension static method not supported
What it means
Thrown in PrecompiledQueryCodeGenerator.GenerateInterceptorMethodSignature (line 719) when the operator symbol is a static method that is not an extension method. The interceptor generator only emits parameters for extension methods (this ...) and instance methods; a plain non-extension static method has no supported first-parameter shape, so it throws NotImplementedException. It marks an unsupported category of operator for the precompiled-query feature.
Source
Thrown at src/EFCore.Design/Query/Internal/PrecompiledQueryCodeGenerator.cs:719
for (var i = 0; i < reducedOperatorSymbol.Parameters.Length; i++)
{
var parameter = reducedOperatorSymbol.Parameters[i];
if (i == 0)
{
switch (reducedOperatorSymbol)
{
case { IsExtensionMethod: true }:
code.Append("this ");
break;
// For instance methods we already added a this parameter above
case { IsStatic: false, ReceiverType: not null }:
code.Append(", ");
break;
default:
throw new NotImplementedException("Non-extension static method not supported");
}
}
else
{
code.Append(", ");
}
code
.Append(_g.TypeExpression(parameter.Type).ToFullString())
.Append(' ')
.Append(parameter.Name);
}
code.AppendLine(")");
foreach (var f in constraints)
{
code.AppendLine(f.NormalizeWhitespace().ToFullString());View on GitHub (pinned to dbf9771522)
Solutions
- Replace the static non-extension call with an equivalent extension-method or instance-method form (e.g. call the operator as an extension so it appears as query.Operator(...)).
- Remove the unsupported operator from the query being precompiled.
- Exclude the query from precompiled-query generation.
- If the method is yours, declare it as an extension method (this IQueryable<T> source, ...) so the interceptor can parameterize it.
Example fix
// before: static non-extension helper used in a precompiled query var q = MyQueryHelpers.Filter(db.Blogs, b => b.Active); // after: express as a standard extension/instance operator var q = db.Blogs.Where(b => b.Active);
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the operator is an extension or instance method before generating
var m = operatorSymbol.OriginalDefinition;
if (m.IsStatic && !m.IsExtensionMethod) { /* exclude query from precompilation */ } Type guard
static bool IsSupportedOperatorKind(IMethodSymbol m)
=> !m.IsStatic || m.IsExtensionMethod; Try / catch
try { /* generate */ }
catch (NotImplementedException ex) when (ex.Message == "Non-extension static method not supported")
{ /* exclude this query; restructure to use extension/instance form */ } Prevention
- Express LINQ helpers as extension methods or instance calls, not static non-extension calls.
- Keep precompiled queries to standard operator invocation forms.
When it happens
Trigger: Precompiling a query whose terminating/intermediate operator resolves to a static, non-extension method (e.g. a helper like Enumerable.Reverse used as a static call, or a custom static LINQ-like method that is not declared as an extension method). The switch over reducedOperatorSymbol in the parameter loop hits the default arm and throws.
Common situations: Calling LINQ-style helpers as static methods (Foo.Method(query, ...) rather than query.Method(...)) where Foo.Method is not an extension method. Using a custom static utility method in a query slated for precompilation. Provider extension methods that were not marked with 'this'.
Related errors
- Couldn't find method symbol for: {memberAccessSyntax}
- Generic method on generic type not supported
- Unsupported type: {type}
- Encountered non-quotable expression of type {node.GetType()}
- Couldn't get interceptable location for: '{node}'.
AI-assisted analysis of dotnet/efcore@dbf9771522 (2026-08-06).
Data as JSON: /api/errors/09ceb60a101718d1.
Report an issue: GitHub.