ReJIT on Attach

A really useful feature of the CLR is that it allows a user to request a new JIT (aka “reJIT”). This is really important for vendors who want to manipulate the IL, one reason may be that the end users would like to increase the instrumentation level, after completing the rewrite you would request a reJIT to apply the changes to the app without restarting.

One glaring limitation of this feature was that In order to enable ReJIT, your profiler would need to be loaded at startup, and set an immutable flag in the Initialize method to enable the ReJIT. In very practical terms this means that if you walked up to a running application and decided you wanted to start ad hoc profiling you would need to restart the application which is not always practical.

As of .Net Core 3 preview5 any profiler developer (including the CLR Instrumentation Engine) have the ability to ReJIT methods after attach! (This will not enabled in desktop .NET)

Improved Snapshot Debugging Experiences

This positively impacts tools like Snapshot Debugger! Customer feedback suggested that forcing users to restart was an awful user experience. Developers would see this message when trying to use Snapshot Debugger for the first time:


Due to the support of ReJIT on Attach, as of Visual Studio 16.6 Preview 2, Snapshot Debugger can now be installed and used on Azure App Services (ASP.NET Core 3.1) without requiring a restart. You can just start debugging live issues without interruption to your service!

I think this is pretty cool! Happy debugging!

Comment Section

Comments are closed.