{"record":{"id":"5339ddd30e78abb8","repo":"SignalR/SignalR","slug":"value-cannot-be-null-5339dd","errorCode":null,"errorMessage":"Value cannot be null.","messagePattern":"Value cannot be null\\.","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.AspNet.SignalR.Core/Hubs/Extensions/MethodExtensions.cs","lineNumber":19,"sourceCode":"﻿// Copyright (c) .NET Foundation. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing Microsoft.AspNet.SignalR.Json;\nusing Newtonsoft.Json.Linq;\n\nnamespace Microsoft.AspNet.SignalR.Hubs\n{\n    public static class MethodExtensions\n    {\n        [SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"1\", Justification = \"The condition checks for null parameters\")]\n        public static bool Matches(this MethodDescriptor methodDescriptor, IList<IJsonValue> parameters)\n        {\n            if (methodDescriptor == null)\n            {\n                throw new ArgumentNullException(\"methodDescriptor\");\n            }\n\n            if ((methodDescriptor.Parameters.Count > 0 && parameters == null)\n                || methodDescriptor.Parameters.Count != parameters.Count)\n            {\n                return false;\n            }\n\n            return true;\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/SignalR/SignalR/blob/693053b89a9e1f5ce819e3233ed159a6409de22b/src/Microsoft.AspNet.SignalR.Core/Hubs/Extensions/MethodExtensions.cs#L1-L32","documentation":"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).","triggerScenarios":"The hub dispatch pipeline or custom code calls methodDescriptor.Matches(parameters) with a null MethodDescriptor, meaning method resolution returned null before binding.","commonSituations":"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.","solutions":["Null-check the MethodDescriptor result of GetHubMethod before calling Matches.","Verify the client invokes an existing, public hub method with the correct name.","In custom dispatch code, guard: if (methodDescriptor == null) return/handle before calling Matches."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var method = hubManager.GetHubMethod(hubName, methodName, args);\nif (method == null)\n{\n    // method not found — handle gracefully\n    return;\n}\nif (method.Matches(parameters)) { /* dispatch */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Null-check MethodDescriptor results from GetHubMethod before calling Matches.","Ensure clients invoke existing, public hub methods with correct names."],"tags":["argumentnullexception","method-matching","parameter-binding","hubs"],"backgroundTag":null,"analyzedSha":"693053b89a9e1f5ce819e3233ed159a6409de22b","analyzedAt":"2026-08-13T22:23:59.793Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}