Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

Making an Image Easier to Debug

0xd4d edited this page Sep 19, 2019 · 7 revisions

When attaching to a random .NET process, it's most likely already optimized. This will make the debugging experience much worse because the debugger can't read all locals or evaluate expressions or call methods. If possible, you should always let the dnSpy debugger start the process.

If you must attach to the process, Microsoft recommends creating an INI file.

If your DLL is called something.dll, then create a something.ini file in the same folder with the following contents:

[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

NOTE: Make sure you save the file without a UTF8 BOM!

Note that you have to do this to every EXE/DLL you wish to debug and see all locals, it's not enough to do this to only the main exe.

Setting environment variables COMPlus_ZapDisable to 1 and COMPlus_ReadyToRun to 0 can also be used to disable loading native images.

Clone this wiki locally