Menu

Decompiling ReadyToRun (R2R) Assemblies: Why Precompiled Native Code Still Decompiles Cleanly
📰

Decompiling ReadyToRun (R2R) Assemblies: Why Precompiled Native Code Still Decompiles Cleanly

DEV Community: dotnet·Zero Heartbeat·5 days ago
#xP1TjgsF
#devtodotnet#devto#dev#native#code
Reading 0:00
15s threshold

If you have ever been handed a "precompiled" .NET assembly and assumed a decompiler would choke on it, ReadyToRun is the happy surprise. R2R is how .NET ships fast-starting code — the runtime libraries themselves are R2R, and PublishReadyToRun=true turns it on for your apps and container images — and it sounds like it should defeat decompilation, because it contains AOT-compiled native code. It does not. An R2R assembly decompiles to clean C# because the one thing R2R never throws away is the IL. Understanding why makes a whole category of "can I read this?" questions easy to answer.

What an R2R image actually contains

A normal .NET assembly is metadata + IL, JIT-compiled to native code on first execution. An R2R image is produced by crossgen2 , which runs that JIT ahead of time and stores the resulting native code in the assembly — so the runtime can skip JITting on startup.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.