Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify the IL #8

Open
josephwoodward opened this issue Jan 30, 2017 · 3 comments
Open

Prettify the IL #8

josephwoodward opened this issue Jan 30, 2017 · 3 comments

Comments

@josephwoodward
Copy link
Owner

josephwoodward commented Jan 30, 2017

Really interested in knowing how TryRoslyn render their IL. What format is it?

.class private auto ansi '<Module>'
{
} // end of class <Module>

.class public auto ansi beforefieldinit C
    extends [mscorlib]System.Object
{
    // Methods
    .method public hidebysig 
        instance void M () cil managed 
    {
        // Method begins at RVA 0x2050
        // Code size 2 (0x2)
        .maxstack 8

        IL_0000: nop                  // Do nothing (No operation)
        IL_0001: ret                  // Return from method, possibly with a value
    } // end of method C::M

    .method public hidebysig specialname rtspecialname 
        instance void .ctor () cil managed 
    {
        // Method begins at RVA 0x2053
        // Code size 8 (0x8)
        .maxstack 8

        IL_0000: ldarg.0              // Load argument 0 onto the stack
        IL_0001: call instance void [mscorlib]System.Object::.ctor() // Call method indicated on the stack with arguments
        IL_0006: nop                  // Do nothing (No operation)
        IL_0007: ret                  // Return from method, possibly with a value
    } // end of method C::.ctor

} // end of class C
@pawlos
Copy link
Contributor

pawlos commented Feb 19, 2017

It looks like this is some kind of standard way of formatting as it can be seen in ILSpy, dnSpy but also ildasm produces the same output. It is also used in Wikipedia entries.

I can see that in case of ILSpy or dnSpy the ICSharpCode.Decompiler library (part of ILSpy - https://github.com/icsharpcode/ILSpy/tree/master/ICSharpCode.Decompiler) is used to produce such output. I'll try to check if it's possible to compile it to be used in this project.

@josephwoodward
Copy link
Owner Author

Oh good investigation! Would be interested to know if it supports .NET Standard.

@pawlos
Copy link
Contributor

pawlos commented Feb 26, 2017

@josephwoodward I'm not much into those .NET Standard stuff - is there a tool that could help checking if the code can be compiled for the given .NET standard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants