Kirk Evans Blog

.NET From a Markup Perspective

Tips for Debugging into managed code

There are just some times when it is super handy to see when function X on the base class has been called with a certain value.  The best example I have of this is debugging layout.  99.99% of all sizing/location logic routes through one single method in System.Windows.Forms.Control – SetBoundsCore. 

There is the super obvious quick fix for this: override the method and see when it gets called.  But if you’ve got a lot of controls, this route can be tedious. 

The following steps work for v1.1 (Everett) (tested from my home machine, nothing up my sleeves).  I have not tested the same steps in Whidbey, although I expect them to be roughly the same (except you might have to turn off Tools->Options->Debugging->Just My Code).  You may also want to right click on the call stack window and select “Show External Code”.

[Via MSDN Blogs]

I bailed on a user group presentation where I was going to show debugging tricks, several of which I picked up from Tim Walton’s Incredible Session at Florida.NET Code CampTim Walton’s incredible session at the Florida .NET Code Camp. This was similar to one of the demos that I was going to show (was going to hit the XmlSerializer as well as poke through the generated assembly).