pdb file is mising after PostSharp

2020-04-03 03:44发布

问题:

I am using PostSharp version 2.1.6.4 (also tried latest version 2.1.7.35) and sometimes pdb file is missing and there is a pssym file in it's place.

<?xml version="1.0" encoding="utf-8"?>
<Symbols xmlns="http://schemas.postsharp.org/2.0/symbols">
  <Class Class="#1=T:[CrosscuttingLogging]CrosscuttingLogging.Attributes.LogMethodCallStatsAttribute" LimitedLicense="true" />
  <Class Class="#2=T:[RequestLimiter]RequestLimiter.RequestCounterAttribute" LimitedLicense="true" />
</Symbols>

I ran procmon on the build process and as far as I can tell the postsharp.srv.4.0-x86.exe process moves both dll and pdb files from obj\Debug folder to obj\Debug\Before-PostSharp folder and later on generates a new dll in obj\Debug folder, but a new pdb file is not generated.

This happens for some of my dlls (seemingly at random) and does not seem to be reliable, because on other machine all pdb files are generated correctly.

回答1:

PostSharp 2.1.x doesn't support Visual Studio 2015 (.NET4.6/Roslyn).

The PDB format has changed a little bit in .NET 4.6. I would expect that there is an exception in PostSharp during PDB post-processing which is the reason why the PDB is not copied to the output folder. If you are using VS2015, then this kind of issues could happen.

The solution is either not to use .NET4.6/Roslyn with PostSharp 2.x or to upgrade to at least PostSharp 3.1.



回答2:

I had this same issue and I upgraded from PostSharp 3.1.46 to 3.1.67 and it did resolve my case. I do get the .pdb file created and I am able to debug again.



回答3:

Same problem, same workaround. Upgraded from 3.1.51 to 3.1.69 and pdb generated again.