SignalR/SignalR · error · ArgumentNullException

Value cannot be null.

Error message

Value cannot be null.

What it means

Thrown by MethodExtensions.Matches when methodDescriptor is null. Matches checks whether a set of incoming JSON parameter values matches a hub method's declared parameter signature (parameter count comparison).

Source

Thrown at src/Microsoft.AspNet.SignalR.Core/Hubs/Extensions/MethodExtensions.cs:19

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.SignalR.Json;
using Newtonsoft.Json.Linq;

namespace Microsoft.AspNet.SignalR.Hubs
{
    public static class MethodExtensions
    {
        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Justification = "The condition checks for null parameters")]
        public static bool Matches(this MethodDescriptor methodDescriptor, IList<IJsonValue> parameters)
        {
            if (methodDescriptor == null)
            {
                throw new ArgumentNullException("methodDescriptor");
            }

            if ((methodDescriptor.Parameters.Count > 0 && parameters == null)
                || methodDescriptor.Parameters.Count != parameters.Count)
            {
                return false;
            }

            return true;
        }
    }
}

View on GitHub (pinned to 693053b89a)

Solutions

  1. Null-check the MethodDescriptor result of GetHubMethod before calling Matches.
  2. Verify the client invokes an existing, public hub method with the correct name.
  3. In custom dispatch code, guard: if (methodDescriptor == null) return/handle before calling Matches.
Defensive patterns

Strategy: validation

Validate before calling

var method = hubManager.GetHubMethod(hubName, methodName, args);
if (method == null)
{
    // method not found — handle gracefully
    return;
}
if (method.Matches(parameters)) { /* dispatch */ }

Prevention

When it happens

Trigger: The hub dispatch pipeline or custom code calls methodDescriptor.Matches(parameters) with a null MethodDescriptor, meaning method resolution returned null before binding.

Common situations: A hub method was not found during dispatch (method name mismatch on the wire) and the null result was not guarded before calling Matches. Custom parameter binding or pipeline modules passing null.

Related errors


AI-assisted analysis of SignalR/SignalR@693053b89a (2026-08-13). Data as JSON: /api/errors/5339ddd30e78abb8. Report an issue: GitHub.