2

On a virtual machine, I was able to unintentionally reproduce an issue that only shows up once every or twice a year. The software is in a state where as long as the application is alive and running, I can reproduce the issue. The only problem is everything was built in release. So when I debug with Visual Studio and try to look at some values, I get the following message:

Cannot evaluate expression because the code of the current method is optimized.

To my knowledge, the only way to work around this is to build in debug. Unfortunately, this isn't possible because as soon as I close the application and restart it in debug instead of release, I may never get a chance to reproduce this issue again.

Is there any tool or anything I can do to keep the software in its current state, yet be able to retrieve some of the values I'm interested in? Again, this is a release build, so I realize a lot of necessary information to debug is missing. I do have the release pdbs / source code for the assemblies I'm interested in. Unlikely that it matters, but I'm trying to look at a Window object's IsLoaded property among potentially a few other properties.

jsirr13
  • 944
  • 2
  • 12
  • 38

2 Answers2

0

Maybe you can try Project Properties - Build - Advanced - Debug info = Full?

According to this answer I think this will allow you to attach a debugger. Other answers in the thread have mixed answers on the effects of this option, but it may be worth a try.

Community
  • 1
  • 1
Sprunth
  • 725
  • 6
  • 10
  • For Release and Debug, I have that property set to Full. So unfortunately, that doesn't make a difference in my case. – jsirr13 May 11 '16 at 18:45
0

I was finally able to solve this by using Snoop, a WPF Spy Utility. It gave me the value of the IsLoaded property I was interested in. Some peers also mentioned using Ants Memory Profiler, but it is pretty expensive and isn't as trivial to use.

jsirr13
  • 944
  • 2
  • 12
  • 38