Have you ever stopped to think about all the things that happen when you execute a simple .NET program?
This talk will delve into the internals of the recently open-sourced .NET Core runtime, looking at what happens, when it happens and why.
Making use of freely available tools such as 'PerfView', we'll examine the Execution Engine, Type Loader, Just-in-Time (JIT) Compiler and the CLR Hosting API to see how all these components play a part in making 'Hello World' possible.
• 1.6 million LOC under src
• 7.6 million LOC under tests
• 22,744 Files (6,668 source & 16,076 test)
– 7,290 C# (1,529 source & 5,761 test)
– 3,641 C and C++
– 3,799 IL (tests)
– 139 Assembly, 10 Python & 6 Perl!!
Virtual Machine (VM)
• Type System, Generics
• Built-in Types
• Loading types/classes
• Exception Handling and Stack Walking
• Event Tracing and Profiling
1. Identify the managed entry point
2. Find and load CoreCLR.dll
3. Get an ICLRRuntimeHost2 Instance
4. Set start-up flags and start the runtime
5. Preparing AppDomain settings
6. Create the AppDomain
7. Run managed code
8. Clean up
Initialising the CLR
• Phase 1 - Set-up infrastructure for all components
• Phase 2 - Initialise the core, low-level components
• Phase 3 - Start-up the low-level components, i.e. error
handling, profiling API, debugging
• Phase 4 - Start the main components, i.e. GC & AppDomains
• Phase 5 - Final setup and send out a notification
– Resources for Learning about .NET Internals
– Exploring the Internals of the .NET Runtime
– Tools for Exploring .NET Internals
– Presentations and Talks covering '.NET Internals'
• Book of the Runtime (BotR)