If broken it is, fix it you should

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)

.NET Debugging Demos - Information and setup instructions

.NET Debugging Demos - Information and setup instructions

Rate This
  • Comments 63

.NET Debugging Demos

This is a series of debugging demos aimed to help you get some hands on experience in debugging the most common types of Hang/performance, memory and crash scenarios in .net applications.

The demos are written in ASP.NET which means that you do need IIS and .net framework 2.0 installed on the development machine where you install the demos.

Each new demo will have a set of instructions on how to get started but the lab instructions are deliberately kept very brief in order to give you the most chance to explore on your own.  Hints will be available for each demo in case you get stuck.

New demos will be published on http://blogs.msdn.com/Tess as time permits (I am planning to release one new lab per week).

All demos will use the same web site so there is only one application to install for all demos.

Note:  These demos will cause high CPU usage, high memory consumption and crashes, so make sure that you are only installing these demos on development machines where no one else will be bothered by the system hanging or the web server crashing.


1. Download the demo site (attached to this post) and unzip the files to a folder on your harddrive. (Rev: just uploaded a new version that shouldn't require 3.5)

2. Set up a new virtual directory in IIS called BuggyBits

3. Browse to the default site http://localhost/BuggyBits/default.htm to make sure that you set up the vdir correctly.

4. Browse to the Company info site http://localhost/BuggyBits/CompanyInformation.aspx to make sure that you can view aspx pages correctly.

5. Download and install the debugging tools for windows from http://www.microsoft.com/whdc/devtools/debugging/default.mspx

6. Run the InternetConnections.reg file by double-clicking it to change the number of outgoing connections you can make to the same site in Internet Explorer (note: any registry modification are done at your own risk, if you feel uncomfortable with this you can view the regfile in notepad and make the changes manually)

7. Install tinyget (comes with the IIS6.0 resource kit http://support.microsoft.com/kb/840671 ) we will be using this for stressing some of the pages in order to produce hangs and memory leaks.

Terminology and tools 

Each demo/lab will assume that you are familiar with the following:


Windbg Debugger installed with the debugging tools for windows.

By default this will be installed in the “debuggers directory” c:\program files\debugging tools for windows
Adplus Script for automating taking memory dumps, also installed in the debuggers directory
Debuggers directory Typically c:\program files\debugging tools for windows
SOS Extension for managed/.net debugging. 

Comes with the framework and exists in the Framework directory (usually C:\Windows\Microsoft.NET\Framework\v2.0.50727) for simplicity you can copy sos.dll to the debuggers directory.
Loading SOS Loading SOS in windbg can be done by running .load <path to sos>\sos.dll at the windbg command line, or by running .loadby sos mscorwks (which will load it from the framework directory).  If sos is copied to the windbg directory you can simply type .load sos
Setting up symbols Symbols are needed for native/non-dotnet debugging and for viewing the non-dotnet parts of the stack. See http://blogs.msdn.com/tess/archive/2005/12/05/why-do-i-get-weird-function-names-on-my-stack-a-discussion-on-symbols.aspx for more info.  To set up the symbol path in windbg you run

  .symfix c:\mycache 

where c:\mycache is where it will store the local copies of the cached symbols.  If you choose to save workspace information when asked in windbg, this symbol path will be saved for the next debugging session.

Tinyget “TinyGet 5.2 (TinyGet.exe) is a command-line Hypertext Transfer Protocol (HTTP) client that supports multiple threads and looping. You can use TinyGet to test or to troubleshoot HTTP client-to-server communication. By using TinyGet, you can customize your test request by configuring many different factors, including the authentication method, the HTTP version, and the output format. You can also use scripts that specify looping and multithreading.”

See http://support.microsoft.com/kb/840671 for more info.

Some familiarity with the sos commands and windbg is also useful. The following articles may be useful to use as reference material:

Install Windbg

Getting started - Part I

Getting started - Part II

Advanced commands

Available Labs:

Lab instructions Lab walkthrough
.NET Debugging Demos Lab 1: Hang Walkthrough 
.NET Debugging Demos Lab 2: Crash Walkthrough
.NET Debugging Demos Lab 3: Memory Walkthrough
.NET Debugging Demos Lab 4: High CPU hang Walkthrough
.NET Debugging Demos Lab 5: Crash Walkthrough
.NET Debugging Demos Lab 6: Memory Leak Walkthrough
.NET Debugging Demos Lab 7: Memory Leak Walkthrough



Attachment: BuggyBits.zip
  • Since I already posted a challenge for this lab earlier I didn't want to wait too long with publishing

  • These look really helpful and I have one or two web apps that could use some scrutiny.  Thanks for posting them!

  • Tess has posted an excellent series on how to debug your applications using Windbg and SOS dll that ships

  • We have reached the end of the .NET Debugging Demos series. And we are going to end it with a review

  • hello , Tess

    tinyget (comes with the IIS6.0 resource kit) is installed on the develop machine(BuggyBits site on the IIS) or the client side(Browse) ?

  • baal,

    Tinyget is your browser in this case (the app that sends the http request).  You can install it wherever you want to, just make sure that the servername, url is valid from your location (i.e. change localhost to the server name if you are doing it removely)... also consider that if you run tinyget remotely then you may have other factors like bandwidht issues between client and server etc. to factor in to what you see as far as response times etc.

  • hi tess,

    If I'm running windows xp (iis 5.1). Would this labs work also if I use inetinfo process instead ?


  • Hi cramirez,

    it would be aspnet_wp.exe, and should work as long as you're running .net framework 2.0

  • You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • SharePoint Debugging and Logging Tips and Tricks

  • I&#39;ve long needed a single source to point people to when it comes to debugging and logging in SharePoint

  • -原文地址:http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx


  • If broken it is, fix it you should : .NET Debugging Demos - Information and setup instructions fantastic

  • If you have hangs, performance, memory issues, exceptions or crashes in Silverlight applications you

  • Hey Tess,

    I absolutely LOVE what you have done here!  These labs are great; I never thought reading about diagnosing memory problems could actually be entertaining, but you have made me a believer.

    That said, I included a plug about your podcast in my weekly podcast (http://www.cubertainment.com), and I also plan to cover these labs in a presentation I'm giving at our local .NET user group (lrdnug.org).

    Thanks so much!


Page 2 of 5 (63 items) 12345
Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post