Using the powers of the debugger to solve the problems of the world - and a bag of chips
by Tess Ferrandez, ASP.NET Escalation Engineer (Microsoft)

Tess Ferrandez

I work as a developer evangelist at Microsoft, and my job is to help
developers make the most of their skills on the MS stack.

In this blog I share tips on anything from debugging and troubleshooting to
development on platforms like Windows, Web, Windows Phone and Kinect. And also some random
tidbits about computing and my life at MS.

I know that perhaps not that many of you know Swedish, but for those of you who do, you might want to check out Michael Deurell’s nice screen casts about how to use visual studio test system to troubleshoot the issues in the buggybits labs along with some windbg fun… His screen casts are called “Fräschast i Bandhagen”, just love that name (unfortunately doesn’t translate that well to English:)) http://blogs.msdn.com/deurell/archive/2008/09/30/debugga-i-produktion-eller-testa-bort-i-utveckligsfas...

John Robbins beat me to the punch and wrote an excellent post about using .cmdtree in windbg to ease some .net debugging pain in windbg. The windbg .cmdtree command allows you to create a popup window in windbg with commands that execute when you click on the respective link... so you no longer have to remember all the sos commands to get around in your managed dump. Read his post here and with the command tree text file he provides you will be up and running in no time... You can also...

Here are of some of the reader emails I got this week and my answers to them... How do I troubleshoot this memory leak Debugging techniques for capturing stacks of OOMS Do you have a list of Debugging 101 links? Debugging managed code in IE Getting to dependency properties with sos let me know if this is something you find useful so I should keep doing it from time to time, or if it's only useful for the selected few who's email I happened to pick this week:) Note: some of the emails have been edited...

I was helping a colleague out with an OOM (OutOfMemory) situation he was dealing with.
Problem description:
Their applications memory usage would grow over time until they finally ended up with an out of memory exception.
First debug:
They had gotten a memory dump when memory usage was really high 1.4 GB using debug diag and I opened it up in windbg.exe , loaded up sos (.loadby sos mscorwks) and ran !dumpheap -stat to get the content of the GC heaps.
0:028> !dumpheap -stat Statistics...

I have probably mentioned this before, but I think it is worth mentioning again because of the frequency of this issue.
When debugging a crash, we usually get customers to use a crash rule in debug diag or to use adplus -crash to get memory dumps at the point of the crash. Both of these attach to the process and gathers dumps when the process is shutting down, which is exactly what we want...
The problem is that very often we will get what I call "false-positive" dumps. I.e. dumps when the...

From time to time we get issues with high memory and performance issues due to massive viewstate. I have talked about it before here , but I thought I'd show some techniques for finding out which pages have high viewstate. If you look at a memroy dump of your process in windbg and notice that your large object heap is riddled with viewstate strings, that doesn't really tell you much, except for that you have some pages that have high viewstate, so the goose chase begings trying to find the source...

When you have to pass an object back and forth between processes or application domains you have to serialize it into some type of stream that can be understood by both the client and the server. The more complex and big the object gets the more expensive it is to serialize, both CPU wise and memory wise, and if the object is big and complex enough you can easily run into out of memory exceptions during the actual serialization process... and that is exactly what happened to one of my...