{"record":{"id":"4eee3f1035667fa3","repo":"lucasg/Dependencies","slug":"loading-pe-file-0-s-failed-file-not-present","errorCode":null,"errorMessage":"Loading PE file \"{0:s}\" failed : file not present on disk.","messagePattern":"Loading PE file \"(.+?)\" failed : file not present on disk\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"DependenciesGui/App.xaml.cs","lineNumber":55,"sourceCode":"        {\n            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\n        }\n\n        private void App_PropertyChanged(object sender, PropertyChangedEventArgs e)\n        {\n            if (e.PropertyName == \"StatusBarMessage\")\n            {\n                mainWindow.AppStatusBarMessage.Content = (object)StatusBarMessage;\n            }\n        }\n\n        public PE LoadBinary(string path)\n        {\n            StatusBarMessage = String.Format(\"Loading module {0:s} ...\", path);\n\n\t\t\tif (!NativeFile.Exists(path))\n\t\t\t{\n\t\t\t\tStatusBarMessage = String.Format(\"Loading PE file \\\"{0:s}\\\" failed : file not present on disk.\", path);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tPE pe = BinaryCache.LoadPe(path);\n            if (pe == null || !pe.LoadSuccessful)\n            {\n                StatusBarMessage = String.Format(\"Loading module {0:s} failed.\", path);\n            }\n            else\n            {\n                StatusBarMessage = String.Format(\"Loading PE file \\\"{0:s}\\\" successful.\", pe.Filepath);\n            }\n            \n            return pe;\n        }\n\n        void App_Startup(object sender, StartupEventArgs e)\n        {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/lucasg/Dependencies/blob/1997a40000b77bd3326cbc33672a7b9f78bb23f3/DependenciesGui/App.xaml.cs#L37-L73","documentation":"Status message set by App.LoadBinary (DependenciesGui/App.xaml.cs:55) when NativeFile.Exists(path) is false. LoadBinary sets StatusBarMessage (which propagates to the status bar via App_PropertyChanged) and returns null. This is the GUI analogue of error 8 and is non-modal: no dialog, just the status bar.","triggerScenarios":"Opening a PE in DependenciesGui whose path does not exist or is a directory, via drag-drop, command-line arg, or recent-files list.","commonSituations":"A file was moved/deleted since it was added to recents; drag-dropping a shortcut whose target is gone; UNC path not reachable; typo in a typed path.","solutions":["Check the status bar message and confirm the path still exists on disk.","Re-add the file via File->Open after restoring/moving it back.","Clear stale entries from the recent-files list if the path is permanently gone."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check existence before calling App.LoadBinary to control the failure mode.\npublic PE SafeLoadBinary(string path)\n{\n    if (!NativeFile.Exists(path))\n    {\n        StatusBarMessage = $\"Loading PE file \\\"{path}\\\" failed : file not present on disk.\";\n        return null;\n    }\n    return (Application.Current as App).LoadBinary(path);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["NativeFile.Exists is preferable to File.Exists here because it disables WOW64 FS redirection and rejects directories.","Null-check the return of LoadBinary at every call site (it returns null on missing files)."],"tags":["gui","file-not-found","status-bar"],"backgroundTag":null,"analyzedSha":"1997a40000b77bd3326cbc33672a7b9f78bb23f3","analyzedAt":"2026-08-13T18:14:41.696Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}