Not able to see locals while debugging into decompiled code

Explore, browse and analyze .NET assemblies

Moderators: Luke Jefferson, Charles Brown, StephenC, Alex.Davies, Greg.Tillman, melvyn.harbour

Not able to see locals while debugging into decompiled code

Postby ChristianWeyer » Thu Feb 18, 2010 11:38 am

Hi there,

what could be the problem that I can step into decompiled code, but cannot actually see the values of the locals and variables?

E.g.
Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away

I mean, not seeing the values makes the debugging into third party code pretty much useless ;)

Thanks!
ChristianWeyer
 
Posts: 4
Joined: Thu Oct 08, 2009 12:04 pm

Postby Clive Tong » Thu Feb 18, 2010 1:32 pm

This will be due to the optimization that the runtime is doing, either at JIT time or ahead of time by the ngen compiler.

Our tool provides a pdb containing mappings between IL instructions and lines of source, and scoping information for local variables. Depending on optimizations that are happening, the debugger cannot always use this information to get all of the information you may like to see.

It's possible to make the optimizations less aggressive by having a debugger attached from the start of the session and by ngening assemblies to make them debuggable.

Do you have a particular example we can look at?
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby ChristianWeyer » Thu Feb 18, 2010 2:30 pm

It is the Microsoft.IdentitModel.dll.

In the meantime I managed to get it working by using the .ini file approach mentioned below:
[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx


Thanks.
ChristianWeyer
 
Posts: 4
Joined: Thu Oct 08, 2009 12:04 pm

Postby Clive Tong » Thu Feb 18, 2010 2:55 pm

Thanks - that's something I've done before to get less optimization.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm

Postby Clive Tong » Fri Feb 04, 2011 10:51 am

I should also point to the following post
http://blogs.msdn.com/b/kirillosenkov/archive/2009/01/27/how-to-disable-optimizations-during-debugging.aspx which shows how setting the COMPLUS_ZapDisable environment variable can turn off some of the optimisation.
Clive Tong
 
Posts: 283
Joined: Thu Dec 04, 2008 5:42 pm


Return to .Net Reflector 6.x and .NET Reflector 6.x Pro

Who is online

Users browsing this forum: No registered users and 1 guest