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.95k stars 112 forks source link

Include comments in generated IL listings #361

Open chillitom opened 6 months ago

chillitom commented 6 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 5 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 😄