lucasg/Dependencies · warning
{0:s} is not a valid PE-COFF file
Error message
{0:s} is not a valid PE-COFF file What it means
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.
Source
Thrown at DependenciesGui/DependencyWindow.xaml.cs:564
}
public void InitializeView()
{
if (!NativeFile.Exists(this.Filename))
{
MessageBox.Show(
String.Format("{0:s} is not present on the disk", this.Filename),
"Invalid PE",
MessageBoxButton.OK
);
return;
}
this.Pe = (Application.Current as App).LoadBinary(this.Filename);
if (this.Pe == null || !this.Pe.LoadSuccessful)
{
MessageBox.Show(
String.Format("{0:s} is not a valid PE-COFF file", this.Filename),
"Invalid PE",
MessageBoxButton.OK
);
return;
}
this.SymPrv = new PhSymbolProvider();
this.RootFolder = Path.GetDirectoryName(this.Filename);
this.SxsEntriesCache = SxsManifest.GetSxsEntries(this.Pe);
this.ProcessedModulesCache = new ModulesCache();
this.ApiSetmapCache = Phlib.GetApiSetSchema();
this._SelectedModule = null;
this._DisplayWarning = false;
// TODO : Find a way to properly bind commands instead of using this hack
this.ModulesList.Items.Clear();View on GitHub (pinned to 1997a40000)
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.
Defensive patterns
Strategy: validation
Validate before calling
this.Pe = (Application.Current as App).LoadBinary(this.Filename);
if (this.Pe == null || !this.Pe.LoadSuccessful)
{
MessageBox.Show($"{this.Filename} is not a valid PE-COFF file", "Invalid PE", MessageBoxButton.OK);
return;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Dropping a text file, linux ELF binary, or corrupted download onto the GUI; stale binary-cache entry; wrong-bitness Dependencies opening an incompatible image.
Related errors
- [x] Could not load file {0:s} as a PE
- Loading module {0:s} failed.
- {0:s} is not present on the disk
- Loading PE file "{0:s}" failed : file not present on disk.
- Can only convert to string.
AI-assisted analysis of lucasg/Dependencies@1997a40000 (2026-08-13).
Data as JSON: /api/errors/9f93ff4193dd9d93.
Report an issue: GitHub.