dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.27k stars 4.74k forks source link

Add debug visualizer for dynamic methods #42131

Open stephentoub opened 4 years ago

stephentoub commented 4 years ago

It can be difficult when using dynamic methods to understand exactly what IL was generated, which is important when debugging them. We should consider adding a simple IL debug visualizer on DynamicMethod.

eerhardt commented 4 years ago

cc @drewnoakes - from https://github.com/drewnoakes/il-visualizer

jkotas commented 4 years ago

We have visualizer like this for crossgen2:

https://github.com/dotnet/runtime/blob/master/src/coreclr/src/tools/Common/TypeSystem/IL/MethodILDebugView.cs https://github.com/dotnet/runtime/blob/master/src/coreclr/src/tools/Common/TypeSystem/IL/ILDisassembler.cs

stephentoub commented 4 years ago

Great. We can always improve it further, but just using / minimally-adapting that would be a great min bar.

krwq commented 3 years ago

cc: @steveharter

danmoseley commented 3 years ago

Marking up for grabs, as this is a nice self contained project - albeit probably significant work - that we could use eg for debugging the regex engine.

@jkotas would it need any runtime work?

danmoseley commented 3 years ago

This would presumably be a significant project -- @eiriktsarpalis maybe we need a label for that? I guess we have 'hard problem' but it's not quite right.

stephentoub commented 3 years ago

It's certainly some work, but I don't think it'd be particularly major, at least not in MVP form. It'd basically be some form of:

steveharter commented 2 years ago

Although not directly related, AssemblyBuilder.Save() has been used in the past for debugging. We plan on doing something here for 8.0.