{"record":{"id":"522c9e2b778cf652","repo":"HangfireIO/Hangfire","slug":"jobstorage","errorCode":null,"errorMessage":"jobStorage","messagePattern":"jobStorage","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Obsolete/RequestDispatcherContext.cs","lineNumber":34,"sourceCode":"using System;\nusing System.Collections.Generic;\nusing System.Text.RegularExpressions;\nusing Hangfire.Annotations;\n\n// ReSharper disable once CheckNamespace\nnamespace Hangfire.Dashboard\n{\n    [Obsolete(\"Use the `DashboardContext` class instead. Will be removed in 2.0.0.\")]\n    public class RequestDispatcherContext\n    {\n        public RequestDispatcherContext(\n            string appPath,\n            int statsPollingInterval,\n            [NotNull] JobStorage jobStorage,\n            [NotNull] IDictionary<string, object> owinEnvironment,\n            [NotNull] Match uriMatch)\n        {\n            if (jobStorage == null) throw new ArgumentNullException(nameof(jobStorage));\n            if (owinEnvironment == null) throw new ArgumentNullException(nameof(owinEnvironment));\n            if (uriMatch == null) throw new ArgumentNullException(nameof(uriMatch));\n\n            AppPath = appPath;\n            StatsPollingInterval = statsPollingInterval;\n            JobStorage = jobStorage;\n            OwinEnvironment = owinEnvironment;\n            UriMatch = uriMatch;\n        }\n\n        public string AppPath { get; }\n        public int StatsPollingInterval { get; }\n        public JobStorage JobStorage { get; }\n        public IDictionary<string, object> OwinEnvironment { get; } \n        public Match UriMatch { get; }\n\n        public static RequestDispatcherContext FromDashboardContext([NotNull] DashboardContext context)\n        {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Obsolete/RequestDispatcherContext.cs#L16-L52","documentation":"Thrown as ArgumentNullException by the obsolete RequestDispatcherContext constructor when the 'jobStorage' JobStorage argument is null. The context carries the storage reference used by dashboard dispatchers to query job state; a null storage makes any dashboard data query impossible, so the constructor rejects it at line 34.","triggerScenarios":"Constructing a RequestDispatcherContext with a null jobStorage — e.g. calling FromDashboardContext when the source OwinDashboardContext.Storage is null (storage never configured), or manually creating the context in tests/custom dispatchers without forwarding a JobStorage instance.","commonSituations":"Dashboard is wired before JobStorage.Current is set (so GlobalConfiguration.Configuration.UseStorage was not called, or called after the dashboard middleware); a custom OWIN host that builds the dashboard context without storage; tests that stub the dashboard pipeline incompletely.","solutions":["Ensure JobStorage is configured via GlobalConfiguration.Configuration.UseXXXStorage(...) (or JobStorage.Current = ...) before the dashboard is mapped.","Prefer the non-obsolete DashboardContext-based dispatchers over RequestDispatcherContext.","If constructing RequestDispatcherContext manually, always forward a non-null JobStorage (e.g. JobStorage.Current)."],"exampleFix":"// before — dashboard mapped before storage is set\napp.MapHangfireDashboard();\nGlobalConfiguration.Configuration.UseSqlServerStorage(cs);\n\n// after\nGlobalConfiguration.Configuration.UseSqlServerStorage(cs);\napp.UseHangfireDashboard();","handlingStrategy":"validation","validationCode":"var storage = JobStorage.Current;\nif (storage == null) throw new InvalidOperationException(\"Configure JobStorage before mapping the dashboard.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure JobStorage (GlobalConfiguration.Configuration.UseStorage) before mapping the dashboard.","Prefer the modern DashboardContext-based dispatchers over RequestDispatcherContext."],"tags":["argument-null","dashboard","storage","configuration","obsolete"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}