{"record":{"id":"370a6f45a8cf2a7b","repo":"dotnet/wpf","slug":"resourcename","errorCode":null,"errorMessage":"resourceName","messagePattern":"resourceName","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/SplashScreen.cs","lineNumber":51,"sourceCode":"        private DispatcherTimer _timer;\n        private TimeSpan _fadeoutDuration;\n        private DateTime _fadeoutEnd;\n        private BLENDFUNCTION _blendFunction;\n        private readonly ResourceManager _resourceManager;\n        private Dispatcher _dispatcher;\n\n        private const string ClassName = \"SplashScreen\";\n\n        public SplashScreen(string resourceName) : this(Assembly.GetEntryAssembly(), resourceName)\n        {\n        }\n\n        public SplashScreen(Assembly resourceAssembly, string resourceName)\n        {\n            ArgumentNullException.ThrowIfNull(resourceAssembly);\n            if (string.IsNullOrEmpty(resourceName))\n            {\n                throw new ArgumentNullException(nameof(resourceName));\n            }\n\n            _resourceName = resourceName.ToLowerInvariant();\n            _hInstance = (HINSTANCE)Marshal.GetHINSTANCE(resourceAssembly.ManifestModule);\n            _resourceManager = new ResourceManager($\"{ReflectionUtils.GetAssemblyPartialName(resourceAssembly)}.g\", resourceAssembly);\n        }\n\n        public void Show(bool autoClose)\n        {\n            Show(autoClose, topMost: false);\n        }\n\n        public unsafe void Show(bool autoClose, bool topMost)\n        {\n            if (!_hwnd.IsNull)\n            {\n                return;\n            }","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/SplashScreen.cs#L33-L69","documentation":"The SplashScreen(Assembly,string) constructor throws ArgumentNullException when resourceName is null or an empty string (via string.IsNullOrEmpty). The resource name is required to locate the embedded splash image in the assembly's .g.resources.","triggerScenarios":"new SplashScreen(assembly, null) or new SplashScreen(assembly, \"\"); passing a name from config/app resources that failed to load. Note the parameter message is 'resourceName'.","commonSituations":"Configuration where the splash resource name is read from appSettings and missing; refactoring removed the hardcoded resource name; build no longer embeds the resource but the name is also blank.","solutions":["Pass the correct embedded resource name (e.g. \"SplashScreen.jpg\" as added with Build Action: Resource)","Validate the configured name before constructing and give a clear config error","If the name is conditional, skip SplashScreen creation entirely when absent"],"exampleFix":"// before\nvar splash = new SplashScreen(Assembly.GetExecutingAssembly(), config.SplashName); // null if unset\n// after\nif (string.IsNullOrEmpty(config.SplashName)) return;\nvar splash = new SplashScreen(Assembly.GetExecutingAssembly(), config.SplashName);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(resourceName)) throw new InvalidOperationException(\"Splash resource name is not configured\");\nvar splash = new SplashScreen(resourceAssembly, resourceName);","typeGuard":"bool HasSplashName(string name) => !string.IsNullOrEmpty(name);","tryCatchPattern":"try { var s = new SplashScreen(asm, name); } catch (ArgumentNullException) { /* skip splash: name not configured */ }","preventionTips":["Validate configuration before constructing SplashScreen","Keep the resource name constant next to the embedded asset","Fail fast at startup config load if the name is blank"],"tags":["wpf","splashscreen","argument-null","resource"],"backgroundTag":"null-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}