{"record":{"id":"62e25c2c2b3ebd9e","repo":"dotnet/wpf","slug":"no-file-exists-at-filepath","errorCode":null,"errorMessage":"No file exists at \"{filePath}\"","messagePattern":"No file exists at \"(.+?)\"","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/Verify.cs","lineNumber":267,"sourceCode":"        public static void TypeSupportsInterface(Type type, Type interfaceType, string parameterName)\n        {\n            Assert.IsNeitherNullNorEmpty(parameterName);\n            Verify.IsNotNull(type, \"type\");\n            Verify.IsNotNull(interfaceType, \"interfaceType\");\n\n            if (type.GetInterface(interfaceType.Name) == null)\n            {\n                throw new ArgumentException(\"The type of this parameter does not support a required interface\", parameterName);\n            }\n        }\n        \n        [DebuggerStepThrough]\n        public static void FileExists(string filePath, string parameterName)\n        {\n            Verify.IsNeitherNullNorEmpty(filePath, parameterName);\n            if (!File.Exists(filePath))\n            {\n                throw new ArgumentException($\"No file exists at \\\"{filePath}\\\"\", parameterName);\n            }\n        }\n        \n        [DebuggerStepThrough]\n        internal static void ImplementsInterface(object parameter, Type interfaceType, string parameterName)\n        {\n            Assert.IsNotNull(parameter);\n            Assert.IsNotNull(interfaceType);\n            Assert.IsTrue(interfaceType.IsInterface);\n\n            bool isImplemented = false;\n            foreach (var ifaceType in parameter.GetType().GetInterfaces())\n            {\n                if (ifaceType == interfaceType)\n                {\n                    isImplemented = true;\n                    break;\n                }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/Verify.cs#L249-L285","documentation":"Verify.FileExists throws ArgumentException when the supplied path is non-empty but File.Exists(filePath) returns false, i.e. no file is present at that path at call time. The message includes the offending path and the exception names the parameter.","triggerScenarios":"Calling a WPF API that calls Verify.FileExists (e.g. resource/font/image loading helpers) with a path to a nonexistent file, or calling Verify.FileExists directly with a stale path.","commonSituations":"Typo in file name or extension; file deleted or moved after path was computed; relative path resolved against an unexpected working directory; case-sensitivity issues when deploying from Windows to a case-sensitive volume; running without access to a network share makes the file appear missing.","solutions":["Check File.Exists(path) before calling and correct the path.","Use an absolute path built via Path.Combine(AppContext.BaseDirectory, ...) instead of relying on the current working directory.","Verify the file was deployed/copied with the application and confirm spelling and extension."],"exampleFix":"// before\ntheme.Load(\"res\\\\Theme.xaml\");\n// after\nstring path = Path.Combine(AppContext.BaseDirectory, \"res\", \"Theme.xaml\");\nif (!File.Exists(path)) throw new FileNotFoundException(path);\ntheme.Load(path);","handlingStrategy":"validation","validationCode":"string fullPath = Path.GetFullPath(path);\nif (!File.Exists(fullPath)) throw new FileNotFoundException($\"Missing file: {fullPath}\", fullPath);","typeGuard":null,"tryCatchPattern":"try { api.Load(path); }\ncatch (ArgumentException ex) when (ex.Message.StartsWith(\"No file exists at\")) { /* prompt user or fall back to default resource */ }","preventionTips":["Always resolve relative paths against AppContext.BaseDirectory, not the working directory.","Check File.Exists immediately before the call; don't cache existence results across long operations.","Include expected data files in deployment/publish outputs."],"tags":["file-not-found","io","wpf"],"backgroundTag":"file-not-found","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}