Aaron Anodide
Aaron Anodide

Reputation: 17196

In the Visual Studio 2010 C# disassembly view, what are those instructions exactly?

I was trying to learn a bit about .NET intermediate language and was hoping to step through it, but from what I can tell, I'm seeing something else - maybe the output of a just-in-time (JIT) compiler?

Is there a way to step through the CIL?

Upvotes: 0

Views: 1474

Answers (3)

Mark Cidade
Mark Cidade

Reputation: 99957

Yes, they are the output of the JIT. See David Moye's answer for a way to step through CIL. .NET Reflector is another great way to learn CIL from your own code.

Upvotes: 2

David Moye
David Moye

Reputation: 800

This article Debugging .NET Framework and MS Visual Studio Managed Classes at Run time and Design time explains how it is possible to seamlessly set breakpoints, step into, set watches and examine local variables for .NET framework classes as well as any other managed assemblies.

Upvotes: 3

Hans Passant
Hans Passant

Reputation: 941635

Your machine never executes IL, it is always translated to machine code. The job of the JIT compiler. The Disassembly window shows you the result of that translation.

As long as you do this with the Debug build then you can see a reasonable match between the IL and the machine code. That disappears however when the JIT optimizer is enabled, it makes a lot of optimizations that make the machine code as fast as reasonably possible. Typical is that entire methods disappear (called inlining), local variables disappear (replaced by CPU registers) and code gets re-organized.

Any introductory book about the x86 assembly language will help you interpret the machine code.

Upvotes: 2

Related Questions