So you want to create your own .NET runtime?
summary
A tiny C runtime loads a compiled .NET DLL, parses PE headers and the CLI metadata tables, and executes IL by interpreting opcodes. The demo uses the old DotNetAnywhere codebase and about 400 lines of C to implement specific opcodes (ret 0x2A, ldc.i4.s, call, add), support for user strings and tokens, and a C hook for Console.WriteLine. Loading another assembly simply calls the same loader. The runtime works end to end for these cases and shows how little is needed to run simple .NET code.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 3:00Hello World program setup
- 10:13PE headers and metadata navigation
- 21:17Entry point and method loading
- 25:32Executing IL instructions
- 31:16Implementing return and LDC instructions
- 36:20Adding method calls and complexity
- 47:00Loading strings and external methods
- 51:44Handling external libraries
- 53:08Q&A and conclusion
related talks
01h 02mSo you want to create your own .NET runtime?
01h 05mFrom 'dotnet run' to 'Hello World!'
01h 00mUnveiling .NET Secrets with the World's Smallest C# Program
39mRunning .NET on the NES
49mFrom 'dotnet run' to 'Hello World!'
58mMobius – writing your own .NET runtime running on .NET Core
59mMobius — Building a Custom .NET Runtime on .NET Core
56m.NET 5: runtimes
