{"record":{"id":"9f93ff4193dd9d93","repo":"lucasg/Dependencies","slug":"0-s-is-not-a-valid-pe-coff-file","errorCode":null,"errorMessage":"{0:s} is not a valid PE-COFF file","messagePattern":"(.+?) is not a valid PE-COFF file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"DependenciesGui/DependencyWindow.xaml.cs","lineNumber":564,"sourceCode":"        }\n\n        public void InitializeView()\n        {\n            if (!NativeFile.Exists(this.Filename))\n            {\n                MessageBox.Show(\n                    String.Format(\"{0:s} is not present on the disk\", this.Filename),\n                    \"Invalid PE\",\n                    MessageBoxButton.OK\n                );\n\n                return;\n            }\n\n            this.Pe = (Application.Current as App).LoadBinary(this.Filename);\n\t\t\tif (this.Pe == null || !this.Pe.LoadSuccessful)\n\t\t\t{\n                MessageBox.Show(\n                    String.Format(\"{0:s} is not a valid PE-COFF file\", this.Filename),\n                    \"Invalid PE\",\n                    MessageBoxButton.OK\n                );\n\n                return;\n            }\n\n            this.SymPrv = new PhSymbolProvider();\n            this.RootFolder = Path.GetDirectoryName(this.Filename);\n            this.SxsEntriesCache = SxsManifest.GetSxsEntries(this.Pe);\n            this.ProcessedModulesCache = new ModulesCache();\n            this.ApiSetmapCache = Phlib.GetApiSetSchema();\n            this._SelectedModule = null;\n            this._DisplayWarning = false;\n\n            // TODO : Find a way to properly bind commands instead of using this hack\n            this.ModulesList.Items.Clear();","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/lucasg/Dependencies/blob/1997a40000b77bd3326cbc33672a7b9f78bb23f3/DependenciesGui/DependencyWindow.xaml.cs#L546-L582","documentation":"Shown by DependencyWindow.InitializeView (DependenciesGui/DependencyWindow.xaml.cs:564) after App.LoadBinary returns a PE that is null or has LoadSuccessful == false. The file existed (error 15 did not fire) but phlib rejected it as a non-PE/COFF image; a modal 'Invalid PE' MessageBox is shown and InitializeView aborts.","triggerScenarios":"Opening an existing file in DependenciesGui that is not a parseable PE: non-PE binary, truncated image, unsupported architecture, or a cache-miss returning a failed PE.","commonSituations":"Dropping a text file, linux ELF binary, or corrupted download onto the GUI; stale binary-cache entry; wrong-bitness Dependencies opening an incompatible image.","solutions":["Verify the file is a real PE with dumpbin or another PE tool.","Disable the binary cache (Options->Properties) and retry to rule out a stale cached PE.","Use the matching x86/x64 Dependencies build for the target image."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"this.Pe = (Application.Current as App).LoadBinary(this.Filename);\nif (this.Pe == null || !this.Pe.LoadSuccessful)\n{\n    MessageBox.Show($\"{this.Filename} is not a valid PE-COFF file\", \"Invalid PE\", MessageBoxButton.OK);\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always test both `pe == null` and `!pe.LoadSuccessful` - LoadBinary can return a non-null failed PE.","Cross-check with another PE tool when a file repeatedly fails to load to confirm it is genuinely not a PE."],"tags":["gui","pe-invalid","load-failure","invalid-pe"],"backgroundTag":null,"analyzedSha":"1997a40000b77bd3326cbc33672a7b9f78bb23f3","analyzedAt":"2026-08-13T18:14:41.696Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}