Just a little Christmas present for those of us that sometimes have to spelunk into Sitecore’s assemblies to find out how something works. Or rather doesn’t work.
Using .Net Reflector or dotPeek or JustDecompile or some similar tool in Visual Studio it is possible to debug and step through third party assemblies, as I’m sure many of you already know. I have done it many times in different scenarios regarding Sitecore, not least when dealing with the Email Campaign Manager.
An irritating thing that might happen during these debugging excursions is the fact that you cannot access some variables or rather their values. Visual Studio kindly informs you that these variables might be “optimized away” which apparently can happen when assemblies are compiled in release mode.
This is enormously frustrating, but there are heroes on the Internet. My life just improved a few notches. Thanks Miguel Nunez and JammyKam!
https://blogs.msdn.microsoft.com/miguelnunez/2014/10/06/debugging-optimized-code-in-net/
https://jammykam.wordpress.com/2015/01/11/how-to-debug-sitecore-kernel-in-visual/