What exactly happens when you run the .NET executable file (step by step until the program is downloaded and launched)?

When you run the .NET executable, what exactly happens is step by step in order. My basic understanding is that you run the executable, the CLR does some checking, compiles the CIL into the platform code, loads it along with the specified necessary dll (as indicated in the manifest) and runs your program.

Can someone clarify this, to the level of "he allocates memory for this and that"? I would really like to know what happens when you double-click on an executable file, when your program runs successfully.

PS diagrams, external links are welcome. :-)

+4
source share
2 answers

There is a reason this information is not available because Microsoft has learned that as soon as you publish something, it should suddenly remain fixed for the whole time (source: 90% of Raymond Chen’s blog ).

The ECMA standard is available from here , although the table of contents shows that it may not cover the material you are using. It definitely indicates the structure, although perhaps not the internal implementation details.

For specific internal details, you need to provide at least the exact version of the .NET Framework that interests you (and we will ignore other CLRs such as Mono ) and information about the program in which you work.

If you have a practical (i.e. debugging) reason for the need for these details, run your executable using windbg and complete the boot process. (It will also work for interests, although it may not be so enjoyable.)

Finally, Mono is open source, so you can look at their code to find out how they decided to implement it. Obviously, there is no guarantee that it is identical to how Microsoft implemented them, but since the academic exercise should be sufficient.

+2
source

One book in which they will all rule: CLR via C # .

+2
source

Source: https://habr.com/ru/post/1340265/


All Articles