kevingosse / UnmanagedExports.Repack

Unmanaged Exports (DllExport for .Net) - Adapted for PackageReference
MIT License
18 stars 16 forks source link

Debugging with breakpoints despites UnmanagedExports #4

Open stevenengland opened 5 years ago

stevenengland commented 5 years ago

First of all: Thanx for your work :) Am I right that if I use unmanaged exports, the .pdb files get useless? As soon as I compile an assembly that uses UnmanagedExports I am not able to hit breakpoints anymore. And as far as I can read on Microsoft side, this is intended behaviour (pdb must match fresh compiled binary and as I understand this is where UE comes in and modifies it). So is there a way to recreate the pdb files also after modifying the dll? Otherwise I might need to exclude UnmanagedExports for Debug configuration or similar to be able to debug the assemblies. What would be a preferable way in that case? All the #if DEBUG compiler directives would be annoying :)

RobertGiesecke commented 4 years ago

Not sure if all of my code survived the decompilation that is used here... Anyways, there's a property DllExportEmitDebugSymbols. If that is true, the task will tell ildasm to emit line number hints. It will then also tell ilasm to generate a pdb.

That pdb will be based on the newly reassembled binary, not the original one.

However, one of the reasons I stopped using this approach was MS making their tools more and more fragile and MSBuild invented always new and interesting ways to break stuff. Around 4.X ildasm or ilasm kept generating incorrect msil when you fed them pdb files. So maybe the author of this package disabled it because of that.

VBWebprofi commented 8 months ago

From current view point I was able to debug from .NET PInvoke project into my .NET Project with UnmanagedExports.