waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.75k stars 105 forks source link

Include comments in generated IL listings #361

Open chillitom opened 3 months ago

chillitom commented 3 months ago

Feature Description

With the F9/Ctrl-F9 IL function, it would be great if comments would persist through to the generated IL, then we could do something like this...

image

In fact every statement could be wrapped in a // START STATEMENT and // END STATEMENT automatically to help find the part of interest and ignore the wrapping async state machine code.

waf commented 2 months ago

Unfortunately, comments are stripped during the compilation process, so I don't think preserving comments is possible.

I like the suggestion to use comments to show the corresponding C#. We actually use the ILSpy library internally in CSharpRepl, so it'd depend on finding the right disassembler setting. The code in CSharpRepl involved with this is in Disassembler.cs -- Pull Requests welcome 😄