Samsung / netcoredbg

NetCoreDbg is a managed code debugger with MI interface for CoreCLR.
MIT License
780 stars 101 forks source link

Breakpoints do not break for generated code #27

Closed manureini closed 5 years ago

manureini commented 5 years ago

Hello,

Thank you for this great debugger. It's working for me with compiled code in vs. But when I generate an assembly with roslyn a breakpoint does not break.

I created a small sample project:

https://github.com/lordmampf/PlaygroundForSamsungNetcoredbg To test start both projects without the vs debugger. When using roslyn a breakpoint does not work.

Do you have any ideas how to fix this issue? Is this an issue with the debugger?

Thank you!

ayuckhulk commented 5 years ago

Hello! Thank you for the kind words! In order for breakpoints to work you need a PDB file with debug info alongside your DLL.

I guess you need to add some EmitOptions with DebugInformationFormat.PortablePdb (see https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.emit.debuginformationformat?view=roslyn-dotnet)

Maybe a thread on StackOverflow could help you: https://stackoverflow.com/questions/50649795/how-to-debug-dll-generated-from-roslyn-compilation

manureini commented 5 years ago

Hello ;)

Yes sure, I forgot that in this example. Now I use the code from stackoverflow to generate the assembly.

I'm getting an breakpoint changed event with verified = true, but the breakpoint still does not break.

lextm commented 5 years ago

It will not break, because of #20 and #19 .

manureini commented 5 years ago

Hello,

Thank you very much for your help! It's working now.

My mistake was, that I had to remove the compiled code from the project. Because the sourefile was used in two different assemblies.

@lextm I tested https://github.com/lextm/netcoredbg/commit/0fcaf6877d3085b18049d2bdeca69685db561b94 on your test branch. For me it's working with this version and your version as well.