{"record":{"id":"43a4db20ea292a06","repo":"HandyOrg/HandyControl","slug":"no-file-exists-at-0","errorCode":null,"errorMessage":"No file exists at \"{0}\"","messagePattern":"No file exists at \"(.+?)\"","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs","lineNumber":217,"sourceCode":"    [SuppressMessage(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n    public static void TypeSupportsInterface(Type type, Type interfaceType, string parameterName)\n    {\n        Verify.IsNotNull<Type>(type, \"type\");\n        Verify.IsNotNull<Type>(interfaceType, \"interfaceType\");\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    [SuppressMessage(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\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(string.Format(CultureInfo.InvariantCulture, \"No file exists at \\\"{0}\\\"\", new object[]\n            {\n                filePath\n            }), parameterName);\n        }\n    }\n\n    [SuppressMessage(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n    [DebuggerStepThrough]\n    internal static void ImplementsInterface(object parameter, Type interfaceType, string parameterName)\n    {\n        bool flag = false;\n        foreach (Type left in parameter.GetType().GetInterfaces())\n        {\n            if (left == interfaceType)\n            {\n                flag = true;\n                break;\n            }","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/src/Shared/Microsoft.Windows.Shell/Standard/Verify.cs#L199-L235","documentation":"Verify.FileExists validates that a string parameter points to an existing file. It first requires a non-null, non-empty string, then calls File.Exists; when no file exists at the path it throws ArgumentException with the formatted path in the message.","triggerScenarios":"Passing a path to an API backed by Verify.FileExists where the file does not exist — wrong relative path (relative to process working directory, not the app), deleted file, wrong drive/extension, or an empty string.","commonSituations":"Working-directory mismatches between dev and production environments, missing deployment files, typos in file names, passing a directory path instead of a file path.","solutions":["Check File.Exists(path) (with Path.GetFullPath) before calling","Resolve relative paths against AppContext.BaseDirectory or a known base directory","Verify the file is deployed/present at the expected absolute path"],"exampleFix":"// before\napi.Load(\"config.xml\"); // relative to CWD — often wrong\n// after\nstring path = Path.Combine(AppContext.BaseDirectory, \"config.xml\");\nif (!File.Exists(path)) throw new FileNotFoundException(\"Missing config\", path);\napi.Load(path);","handlingStrategy":"validation","validationCode":"string fullPath = Path.GetFullPath(path);\nif (string.IsNullOrWhiteSpace(fullPath)) throw new ArgumentException(\"Path required\", nameof(path));\nif (!File.Exists(fullPath)) throw new FileNotFoundException(\"File missing\", fullPath);","typeGuard":null,"tryCatchPattern":"try { api.Load(path); } catch (ArgumentException ex) when (ex.Message.StartsWith(\"No file exists at\")) { /* restore/ship the missing file or prompt user */ }","preventionTips":["Resolve relative paths against AppContext.BaseDirectory, not CWD","Check File.Exists before calling and log the absolute path","Ensure required files are included in deployment/publish output"],"tags":["file","io","argument-validation"],"backgroundTag":"file-not-found","analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}