This week I was debugging a managed code Application with WinDBG and PSSCOR2 extension.
I had to take a look at the managed call stack including it’s function parameter using !CLRStack –p
The output looked similar to this one (the problem is the <no data> tag for the argument “args”)
After quite some time of research I gave up and later on met a colleague who was able to give me the answer.
The assemblies I was debugging were release assemblies and the Just In Time Compiler (JIT) does lots of performance optimizations so that the debugging extensions are not able to extract the parameter values.
The solution to this problem is to tell the JIT compiler to avoid optimization during while debugging. Unfortunately this means that there is no easy way to fix the issue when only looking at post mortem memory dumps.
The following MSDN Article demonstrates how to ease image debugging: http://msdn.microsoft.com/en-us/library/9dd8z24x(v=VS.100).aspx
If your create a text file “application.ini” next to your application.ini and make sure it contains the following lines before starting the program:
For debug builds you usually do not have to do this as optimizations are disabled anyway.
When generating native images with NGEN.EXE this settings are also considered so that you can take control over NI optimizations, too!
After applying these changes the !CLRStack –p output looked as follows:
Now you can look at the args value using !DumpObject 0x0242bf80 or !DumpArray 0x0242bf80: