Open sandboxFocusImprove this doc

PS0262: PDB File Contains Unexpected Data

Severity Warning
Reported by PostSharp
Message PostSharp encountered recoverable errors while reading the PDB file of <Module>. The debugging experience may be affected.

Cause

PostSharp reads the portable PDB file that the compiler writes next to the assembly, and writes a new PDB file for the woven assembly, so that you can debug your code after PostSharp has modified it. When the reader finds a record that it does not expect, for example an import scope, a constant or a custom debugging information of an unknown kind, it skips the record and goes on reading. PostSharp reports PS0262 once per module, on the first of these records. <Module> is the module whose PDB file is read.

The records that PostSharp skips are lost from the PDB file of the woven assembly. The build succeeds, but the debugger may show less information, for example for local constants or the using directives of a method.

The message usually means that the compiler wrote debugging information that this version of PostSharp does not know yet, for example after an update of the .NET SDK. It depends on the content of a PDB file, so no example can show it.

Resolution

  • Update PostSharp to the latest version of your release: newer versions read the debugging information of newer compilers.
  • To see which records PostSharp skipped, capture the DebugReader trace category with the PostSharpTrace MSBuild property, as Well-Known MSBuild Properties describes, and send the trace and the PDB file to the support of PostSharp.
  • When the debugging experience of the woven assembly is good enough for you, disable the warning with the PostSharpDisabledMessages MSBuild property, for example <PostSharpDisabledMessages>PS0262</PostSharpDisabledMessages>.

See Also

Other Resources

Well-Known MSBuild Properties