dotnet/reactive · error · InvalidOperationException

There is no method '{0}' on type '{1}' that matches the spec

Error message

There is no method '{0}' on type '{1}' that matches the specified arguments

What it means

In the Redir expression visitor, when redirecting a static call to the equivalent Ix.NET method, it searches all methods with the target name on the target type for one whose parameters match the supplied arguments. If none match, it throws InvalidOperationException("There is no method '<name>' on type '<type>' that matches the specified arguments"). This means the expression's argument shapes cannot be reconciled with any overload in the Ix library.

Solutions

  1. Change the query to use an overload that exists on the Ix operator (match parameter count and types to the library signature).
  2. Check that System.Interactive / System.Interactive.Providers versions are consistent and support the overload you used.
  3. Wrap the arguments in explicit AsQueryable()/casts so argument types align with the target overload.
  4. If the operator genuinely lacks the overload, implement the logic client-side (AsEnumerable) instead of redirecting.

Example fix

// before
// redirect fails: no matching overload with 2 args
var q = source.MyOp(x => x.Id, comparer);
// after
// use the supported overload arity
var q = source.MyOp(x => x.Id);
Defensive patterns

Strategy: try-catch

Validate before calling

var candidates = typeof(IxOps).GetMethods().Where(m => m.Name == opName && m.GetParameters().Length == args.Count); if (!candidates.Any()) throw new InvalidOperationException($"No Ix overload '{opName}' accepts {args.Count} args");

Try / catch

try { var redirected = RedirectCall(node); } catch (InvalidOperationException ex) when (ex.Message.Contains("that matches the specified arguments")) { // fall back to client-side evaluation node.AsEnumerable() }

Prevention

When it happens

Trigger: Query translation where the redirected method name exists on the target type but no overload accepts the argument count/types, or where generic type arguments inferred from the source method do not satisfy any candidate.

Common situations: Using an overload signature that the Ix operator does not implement (e.g. different comparer/selector arity), version drift between the app's operator usage and the installed Ix version, or provider-generated expressions with wrapped/quoted argument types.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/2b5af582668e14e1. Report an issue: GitHub.

Appendix: source

Thrown at Ix.NET/Source/System.Interactive.Providers/System/Linq/QueryableEx.cs:69

                {
                    if (mce.Arguments.Count >= 1 && typeof(IQueryProvider).IsAssignableFrom(mce.Arguments[0].Type))
                    {
                        if (mce.Arguments[0] is ConstantExpression ce)
                        {
                            if (ce.Value is QueryProviderShim)
                            {
                                var targetType = typeof(QueryableEx);
                                var method = mce.Method;
                                var methods = GetMethods(targetType);
                                var arguments = mce.Arguments.Skip(1).ToList();

                                //
                                // From all the operators with the method's name, find the one that matches all arguments.
                                //
                                var typeArgs = method.IsGenericMethod ? method.GetGenericArguments() : null;
                                var targetMethod = methods[method.Name].FirstOrDefault(candidateMethod => ArgsMatch(candidateMethod, arguments, typeArgs));
                                if (targetMethod == null)
                                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "There is no method '{0}' on type '{1}' that matches the specified arguments", method.Name, targetType.Name));

                                //
                                // Restore generic arguments.
                                //
                                if (typeArgs != null)
                                    targetMethod = targetMethod.MakeGenericMethod(typeArgs);

                                //
                                // Finally, we need to deal with mismatches on Expression<Func<...>> versus Func<...>.
                                //
                                var parameters = targetMethod.GetParameters();
                                for (int i = 0, n = parameters.Length; i < n; i++)
                                {
                                    arguments[i] = Unquote(arguments[i]);
                                }

                                //
                                // Emit a new call to the discovered target method.

View on GitHub (pinned to 94b5d5ab91)