Skip to content

Conversation

@bitfaster
Copy link
Owner

@bitfaster bitfaster commented Jul 19, 2020

Use Mono.Cecil/Mono.Reflection to disassemble to IL.

Test outputs this:

	IL_0000: nop
	IL_0001: call System.Reflection.Assembly System.Reflection.Assembly::GetExecutingAssembly()
	IL_0006: stloc.0
	IL_0007: ldarg.0
	IL_0008: call System.Type System.Object::GetType()
	IL_000d: ldstr "Test"
	IL_0012: callvirt System.Reflection.MethodInfo System.Type::GetMethod(string)
	IL_0017: stloc.1
	IL_0018: ldloc.1
	IL_0019: call string JitExplorer.Engine.IL.Formatter::FormatMethodBody(System.Reflection.MethodBase)
	IL_001e: stloc.2
	IL_001f: ldarg.0
	IL_0020: ldfld Xunit.Abstractions.ITestOutputHelper JitExplorer.Engine.UnitTests.IL.DissassembleILTests::output
	IL_0025: ldloc.2
	IL_0026: callvirt void Xunit.Abstractions.ITestOutputHelper::WriteLine(string)
	IL_002b: nop
	IL_002c: ret

@bitfaster bitfaster changed the title Disassemble IL Mono.Reflection disassemble IL Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant