{"record":{"id":"cd7222e25c3bfb20","repo":"HangfireIO/Hangfire","slug":"routes","errorCode":null,"errorMessage":"routes","messagePattern":"routes","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Dashboard/RouteCollectionExtensions.cs","lineNumber":71,"sourceCode":"            [NotNull] this RouteCollection routes,\n            [NotNull] string pathTemplate,\n            [NotNull] Func<DashboardContext, bool> command)\n        {\n            if (routes == null) throw new ArgumentNullException(nameof(routes));\n            if (pathTemplate == null) throw new ArgumentNullException(nameof(pathTemplate));\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.Add(pathTemplate, new CommandDispatcher(command));\n        }\n\n#if FEATURE_OWIN\n        [Obsolete(\"Use the AddBatchCommand(RouteCollection, string, Func<DashboardContext, bool>) overload instead. Will be removed in 2.0.0.\")]\n        public static void AddBatchCommand(\n            [NotNull] this RouteCollection routes, \n            [NotNull] string pathTemplate, \n            [NotNull] Action<RequestDispatcherContext, string> command)\n        {\n            if (routes == null) throw new ArgumentNullException(nameof(routes));\n            if (pathTemplate == null) throw new ArgumentNullException(nameof(pathTemplate));\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.Add(pathTemplate, new BatchCommandDispatcher(command));\n        }\n#endif\n\n        public static void AddBatchCommand(\n            [NotNull] this RouteCollection routes,\n            [NotNull] string pathTemplate,\n            [NotNull] Action<DashboardContext, string> command)\n        {\n            if (routes == null) throw new ArgumentNullException(nameof(routes));\n            if (pathTemplate == null) throw new ArgumentNullException(nameof(pathTemplate));\n            if (command == null) throw new ArgumentNullException(nameof(command));\n\n            routes.Add(pathTemplate, new BatchCommandDispatcher(command));\n        }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Dashboard/RouteCollectionExtensions.cs#L53-L89","documentation":"The OWIN-specific AddBatchCommand overload (RouteCollectionExtensions.cs:71) throws ArgumentNullException when the routes parameter (the RouteCollection being extended) is null. The extension method cannot register a command dispatcher without a target collection.","triggerScenarios":"Calling routes.AddBatchCommand(...) (the OWIN Action<RequestDispatcherContext,string> overload) where the routes variable is null.","commonSituations":"Dashboard routes collection was not initialized or was set to null before the extension method call; custom dashboard setup code with a null guard missing.","solutions":["Ensure the RouteCollection instance passed as 'routes' is non-null and properly initialized before calling AddBatchCommand.","Pass the dashboard's Routes collection directly rather than a cached/nullable reference."],"exampleFix":"// before\nRouteCollection routes = null;\nroutes.AddBatchCommand(\"/delete\", (ctx, id) => true);\n\n// after\nvar routes = new RouteCollection();\nroutes.AddBatchCommand(\"/delete\", (ctx, id) => true);","handlingStrategy":"validation","validationCode":"if (routes == null)\n    throw new ArgumentNullException(nameof(routes));\nroutes.AddBatchCommand(\"/cmd\", (ctx, id) => true);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize the RouteCollection before calling any Add* extension methods.","Use the dashboard pipeline's built-in Routes collection."],"tags":["dashboard","argument-null","owin","routes"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}