Show Compiler-Generated Code option is badly broken.

Hello,

 

When the "Show Compiler-Generated Code" option is set to true, things such as the "foreach" statement when decompiled should translate to methods such as CurrentMoveNextReset, Dispose etc and not show the "foreach" statement.

Also, when using nullable types such as when declaring a Int32? variable, the decompiled code should show Nullable<Int32> and not Int32?.

These are just two problems I found but I have a feeling there are many more.

It was my impression that the whole point of the "Show Compiler-Generated Code" option was to show what the compiler was doing (primarily for learning and exploring purposes). If the decompliation is optimizing the code by showing syntactic sugar when that flag is set then it defeats the whole purpose.

Thank you.

2 comments

Man, this utility does not even expose the background implementation of a delegate, all it shows is the "delegate" keyword but not the backing class with all of its members (Invoke, BeginInvoke, EndInvoke, etc).

Maybe I am missing something here, could someone please elaborate on what exactly the "Show Compiler-Generated Code" option is supposed to do when enabled?

Thanks.

 

 

0

Hello,

Enabling this option will show the source code which is marked with "System.Runtime.CompilerServices.CompilerGeneratedAttribute". See the help article here for more info: https://www.jetbrains.com/help/decompiler/Viewing_Compiler_Generated_Code.html

If we follow the suggestions you provided, decompiled code will not have any loops (for, foreach, while), having whole code covered only with 'goto'.

If you want in-depth code analysis, I would suggest using the IL Viewer (which is, basically, what compiler did generate).

Hope that answered the question. Thanks!

0

Please sign in to leave a comment.