{"record":{"id":"6252b0a33870f785","repo":"HangfireIO/Hangfire","slug":"resource-with-name-resourcename-not-found-in-ass","errorCode":null,"errorMessage":"Resource with name {resourceName} not found in assembly {assembly}.","messagePattern":"Resource with name (.+?) not found in assembly (.+?)\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.Core/Dashboard/EmbeddedResourceDispatcher.cs","lineNumber":61,"sourceCode":"            context.Response.ContentType = _contentType;\n            context.Response.SetExpire(DateTimeOffset.Now.AddYears(1));\n\n            await WriteResponse(context.Response).ConfigureAwait(false);\n        }\n\n        protected virtual Task WriteResponse(DashboardResponse response)\n        {\n            return WriteResource(response, _assembly, _resourceName);\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Performance\", \"CA1822:Mark members as static\", Justification = \"Context can be potentially accessed in derived classes.\")]\n        protected async Task WriteResource(DashboardResponse response, Assembly assembly, string resourceName)\n        {\n            using (var inputStream = assembly.GetManifestResourceStream(resourceName))\n            {\n                if (inputStream == null)\n                {\n                    throw new ArgumentException($@\"Resource with name {resourceName} not found in assembly {assembly}.\");\n                }\n\n                await inputStream.CopyToAsync(response.Body).ConfigureAwait(false);\n            }\n        }\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":69,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.Core/Dashboard/EmbeddedResourceDispatcher.cs#L43-L69","documentation":"EmbeddedResourceDispatcher.WriteResource (EmbeddedResourceDispatcher.cs:61) looks up a manifest resource stream by name within an assembly. If GetManifestResourceStream returns null the resource name does not match any embedded resource in that assembly (names are case-sensitive and include the default namespace prefix), and an ArgumentException is thrown.","triggerScenarios":"Registering a dashboard route with an EmbeddedResourceDispatcher(assembly, resourceName) where resourceName does not exactly match the full manifest resource name (including namespace) in the given assembly.","commonSituations":"Default namespace differs from assembly name; resource file was moved or renamed; project uses a custom root namespace; the resource's Build Action is not set to 'Embedded Resource'; casing mismatch between the passed name and the manifest name.","solutions":["Enumerate assembly.GetManifestResourceNames() and use the exact returned string.","Ensure the resource file's Build Action is 'Embedded Resource' in the .csproj.","Prefix the resource name with the project's default namespace (e.g. 'MyApp.Assets.style.css').","Pass the correct assembly instance (typeof(LocalType).Assembly) rather than a different assembly."],"exampleFix":"// before\napp.UseHangfireDashboard(\"/dashboard\", new DashboardOptions\n{\n    AdditionalData = new[]\n    {\n        new EmbeddedResourceDispatcher(typeof(Startup).Assembly, \"assets.css\")\n    }\n});\n\n// after\nvar assembly = typeof(Startup).Assembly;\nvar name = assembly.GetManifestResourceNames()\n    .First(n => n.EndsWith(\"assets.css\"));\nvar dispatcher = new EmbeddedResourceDispatcher(assembly, name);","handlingStrategy":"validation","validationCode":"var assembly = typeof(Startup).Assembly;\nvar available = assembly.GetManifestResourceNames();\nif (!available.Contains(resourceName, StringComparer.Ordinal))\n    throw new ArgumentException(\n        $\"Resource '{resourceName}' not found. Available: {string.Join(\", \", available)}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call assembly.GetManifestResourceNames() to discover the exact embedded resource name.","Ensure the resource file's Build Action is 'Embedded Resource'.","Remember manifest resource names are case-sensitive and include the default namespace.","Pass typeof(LocalType).Assembly to ensure the correct assembly."],"tags":["dashboard","embedded-resource","manifest","configuration"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}