dotnet/reactive · error · NotImplementedException
The method or operation is not implemented.
Error message
The method or operation is not implemented.
What it means
The non-generic IQueryProvider.CreateQuery(Expression) overload of the ObservableQuery provider is deliberately unimplemented — the bridge only supports the generic CreateQuery<T> path used by ToQueryable. Calling the non-generic overload always throws NotImplementedException.
Solutions
- Use the generic IQueryProvider.CreateQuery<T>(Expression) path instead (via ToQueryable<T>)
- Cast the queryable to its typed IQueryable<T> interface before creating queries
- Wrap the call and surface a clearer error explaining only the generic provider API is supported
Example fix
// before IQueryable q = ((IQueryProvider)provider).CreateQuery(expression); // after IQueryable<T> q = ((IQueryProvider)provider).CreateQuery<T>(expression);
Defensive patterns
Strategy: try-catch
Validate before calling
var typed = queryable as IQueryable<T>; if (typed == null) throw new NotSupportedException("Use the generic CreateQuery<T> path"); Type guard
static bool SupportsGenericCreateQuery(IQueryProvider p) => p is IQueryProvider && typeof(IQueryable<>).IsAssignableFrom(p.GetType());
Try / catch
try { return provider.CreateQuery(expression); } catch (NotImplementedException) { throw new NotSupportedException("Non-generic CreateQuery is not supported by the ObservableQuery bridge; use CreateQuery<T>."); } Prevention
- Always work with the typed IQueryable<T> interface
- Avoid reflection/late-binding paths that resolve the non-generic provider API
- Prefer consuming IQbservable directly instead of the bridge
When it happens
Trigger: Calling IQueryProvider.CreateQuery (non-generic) on the ObservableQuery provider, e.g. via late-bound reflection code or non-generic IQueryable usage patterns.
Common situations: Framework code that resolves the provider through the non-generic IQueryable interface, data-binding or LINQ infrastructure that only has an Expression and no compile-time T.
Related errors
AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15).
Data as JSON: /api/errors/be1dc0f7174c0d34.
Report an issue: GitHub.
Appendix: source
Thrown at Rx.NET/Source/src/System.Reactive/ObservableQuery.cs:84
arg0
)
);
//
// Queryable operator calls should be taken care of by the provider for
// LINQ to Objects. So we compile and get the resulting IQueryable<T>
// back to hand it out.
//
return Expression.Lambda<Func<IQueryable<TElement>>>(res).Compile()();
}
private static MethodInfo? _staticAsQueryable;
private static MethodInfo AsQueryable => _staticAsQueryable ??= Qbservable.InfoOf<object>(() => Queryable.AsQueryable<object>(null!)).GetGenericMethodDefinition();
IQueryable IQueryProvider.CreateQuery(Expression expression)
{
throw new NotImplementedException();
}
TResult IQueryProvider.Execute<TResult>(Expression expression)
{
throw new NotImplementedException();
}
object IQueryProvider.Execute(Expression expression)
{
throw new NotImplementedException();
}
}
#if HAS_TRIMMABILITY_ATTRIBUTES
[RequiresUnreferencedCode(Constants_Core.AsQueryableTrimIncompatibilityMessage)]
#endif
internal class ObservableQuery
{View on GitHub (pinned to 94b5d5ab91)