{"record":{"id":"680d02d2d6825a2a","repo":"HangfireIO/Hangfire","slug":"owinenvironment","errorCode":null,"errorMessage":"owinEnvironment","messagePattern":"owinEnvironment","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Dashboard/UrlHelper.cs","lineNumber":30,"sourceCode":"// \n// You should have received a copy of the GNU Lesser General Public \n// License along with Hangfire. If not, see <http://www.gnu.org/licenses/>.\n\nusing System;\nusing System.Collections.Generic;\nusing Hangfire.Annotations;\n\nnamespace Hangfire.Dashboard\n{\n    public class UrlHelper\n    {\n#if FEATURE_OWIN\n        private readonly Microsoft.Owin.OwinContext _owinContext;\n\n        [Obsolete(\"Please use UrlHelper(DashboardContext) instead. Will be removed in 2.0.0.\")]\n        public UrlHelper([NotNull] IDictionary<string, object> owinEnvironment)\n        {\n            if (owinEnvironment == null) throw new ArgumentNullException(nameof(owinEnvironment));\n            _owinContext = new Microsoft.Owin.OwinContext(owinEnvironment);\n        }\n#endif\n\n        private readonly DashboardContext _context;\n\n        public UrlHelper([NotNull] DashboardContext context)\n        {\n            if (context == null) throw new ArgumentNullException(nameof(context));\n            _context = context;\n        }\n\n        public string To(string relativePath)\n        {\n            return _context.Options.PrefixPath +\n                   (\n#if FEATURE_OWIN\n                       _owinContext?.Request.PathBase.Value ??","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Dashboard/UrlHelper.cs#L12-L48","documentation":"The obsolete UrlHelper constructor taking an OWIN environment dictionary (UrlHelper.cs:30) throws ArgumentNullException when owinEnvironment is null. The constructor wraps the dictionary in an OwinContext for request path resolution. This overload is deprecated in favor of UrlHelper(DashboardContext).","triggerScenarios":"Instantiating new UrlHelper(null) via the OWIN dictionary overload, or passing a variable that resolved to null.","commonSituations":"Legacy OWIN-based dashboard middleware passing a null environment; migrating from OWIN to ASP.NET Core and the environment dictionary is no longer available.","solutions":["Migrate to the UrlHelper(DashboardContext) constructor which is the supported API.","If keeping the OWIN overload, ensure the environment dictionary is non-null."],"exampleFix":"// before (obsolete OWIN overload)\nvar helper = new UrlHelper(owinEnv); // owinEnv may be null\n\n// after (supported overload)\nvar helper = new UrlHelper(dashboardContext);","handlingStrategy":"validation","validationCode":"if (owinEnvironment == null)\n    throw new ArgumentNullException(nameof(owinEnvironment));\nvar helper = new UrlHelper(owinEnvironment);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate to the UrlHelper(DashboardContext) constructor (supported API).","Ensure the OWIN environment dictionary is non-null if using the obsolete overload."],"tags":["dashboard","argument-null","owin","obsolete","url-helper"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}