Open sandboxFocusImprove this doc

PS0259: PDB File Has an Unknown Format

Severity Warning
Reported by PostSharp
Message The file "<PdbPath>" is not a valid PDB: it is neither a Windows PDB nor a portable PDB. PostSharp ignores its debugging information.

Cause

PostSharp reads the debugging information of the assemblies that it processes: the PDB file next to the assembly, with the same name and the .pdb extension, or, when there is no such file, the portable PDB embedded in the assembly. PostSharp first checks whether the file is a Windows PDB. When it is not, PostSharp reads it as a portable PDB.

PostSharp reports PS0259 when the file is not a Windows PDB and its content cannot be read as a portable PDB either. PostSharp then continues without the debugging information of this assembly. <PdbPath> is the path of the PDB file, or names the assembly whose embedded PDB is invalid.

The usual causes are a PDB file that is empty, truncated or corrupted, for example by a build that was interrupted while writing it, a PDB file left over from another build or another tool, or a tool that rewrote the assembly or its PDB before PostSharp and produced an invalid file. A Windows PDB that PostSharp cannot read produces PS0134 instead.

This message depends on a corrupted file, so no example can show it.

Resolution

  • Clean and rebuild the project: delete its bin and obj folders, and build again, so that the compiler writes a new PDB file.
  • When the path is the PDB of a referenced assembly, for example in a NuGet package, delete the package from the NuGet cache (dotnet nuget locals global-packages --clear, or only the folder of the package) and restore it again. When the file is not needed, delete it: PostSharp then reads the embedded PDB, or none.
  • When another tool rewrites the assembly before PostSharp, such as an obfuscator or another IL weaver, check that it writes a valid portable or Windows PDB, or run it after PostSharp.
  • Check the DebugType property of the project. The values portable, embedded and full produce formats that PostSharp reads.

See Also

Other Resources

Well-Known MSBuild Properties