Why value-types are stored onto Stacks?

Eric Lippert discusses this here; firstly, it is incorrect that “value types are stored on the stack”. They sometimes are, but not as: fields on a class captured variables variables in an iterator block When they can be stored on the stack it is a convenient way of modelling their lifetime, but it isn’t required … Read more

Where is the .NET JIT-compiled code cached?

Memory. It can be cached, that’s the job of ngen.exe. It generates a .ni.dll version of the assembly, containing machine code and stored in the GAC. Which automatically gets loaded afterward, bypassing the JIT step. But that has little to do with why your program starts faster the 2nd time. The 1st time you have … Read more

Where is the .NET JIT-compiled code cached?

Memory. It can be cached, that’s the job of ngen.exe. It generates a .ni.dll version of the assembly, containing machine code and stored in the GAC. Which automatically gets loaded afterward, bypassing the JIT step. But that has little to do with why your program starts faster the 2nd time. The 1st time you have … Read more

Is the CLR a virtual machine?

There are a lot of misconceptions here. I suppose you could think of .Net as a virtual machine if you really wanted, but let’s look at how the .Net Framework really handles your code. The typical scenario looks like this You write a .Net program in C#, VB.Net, F#, or some other compatible language. That … Read more

Retrieve JIT output

While debugging your application in Visual Studio, you can right-click on a code where you have stopped (using breakpoint) and click “Go to Disassembly”. You can debug through native instructions. As for doing that with *.exe files on disk, maybe you could use NGen to generate native output and then disassemble it (although I never … Read more