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
  • elcarlos14,

    I have ran these labs on IIS7, both with the 2.0 framework (and 3.5) as well as with the 4.0 framework.

    Both debugging tools for windows and tinyget can be installed and work on Vista, 2008 and Win7, with IIS7.

    Are you having any specific issues? or are you just asking in preparation for doing this?

  • Hey Tess,

    I'm just asking before I get into the labs, thanks for the info!

  • This blog has just helped us diagnose what was a diabolical memory allocation issue in IE7. Not only have you saved us from having to possibly re-architect a large chunk of our first release of software, but have given us some valuable knowledge on how to combat such issues when released.

    Many, many thanks.

  • Hi

    I am trying to open the aspx but its failing , i have installed .net 3.0 framework.

    Are there anyother settings which i need to perform ?

  • Great labs ! Fantastic work..

    Just a quick question, whats the impact of the Registry edit and restricting/expanding the number of allowable connections per server? After we finish the lab, do we have to put it back somehow or does it not matter?

  • Hi Tess ,

    Brief  me  what are all the setting required to ran these labs on IIS7 , .Net framework 4.0 and also Windows7  .

  • Sharath,  

    I don't think there were any specific things i needed to do, I just set it to run in a 4.0  app pool in IIS.  I seem to remember that there might have been some small config changes based on errors, but are you having issues getting it to run?  can you give some specifics?  There shouldnt be anything in there that is 2.0 specific

  • Hi Tess ,

    Actually i new to WINDBG Tool so need your help to analyze application crash dump file . the below is the scenario description

    we are frequently getting "Server Unavailable" error from the application .

    Application developed using VS 2008 , IIS 6.0 , SQL Server 2005 and Windows server 2003.

    Finally choose WINDBG Tool analyze  "Server Unavailable" error and taken application crash dump files from the sever.

    I followed the steps given in this link www.develop.com/.../SOS.pdf

    When i ran the command !DumpHeap -stat , getting thousands of objects.

    Here i am getting stuck to identify which object is giving error.

    Please tell me How to identify the object  which is giving error ?  How to fix the error in the above scenario ?



  • Sharath,

    Server Unavailable usually means that the process crashed which could be due to a million and one reasons.  The link you mentioned walks through a basic investigation of why an object is not collected which probably doesn't have a whole lot to do with your problem.  The best advice I can give on how to start out is to try going through some of the crash labs in this series and apply the steps to your dump if you got a crash dump.


  • Hi Tess ,

         Can we work these labs in production server ( Means only .Net frame work 2.0 not entire VS 2005 or VS 2008 )?  Because i am getting the following

    Server Application Unavailable

    The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request.

    Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

    Is it required entire VS 2005 or VS 2008?

  • Not sure I understand...  you should definitely not install any of these labs in a production environment, they are designed to crash and cause memory leaks for learning purposes only.

    If you are referring to whether you can gather dumps in production then yes, you can using debug diag, procdmp, adplus etc. but i would recommend debugging the dumps on a developer machine.

    Windbg is a tool that requires a good deal of background knowledge of debugging which is why i have set up these labs for people to learn, but if your issue is very urgent i would suggest that you contact support as debugging with windbg is not something you neccessarily want to learn under preassure.

  • Hi Tess,

    I'm getting frequent APPCRASH error in eventviewer and the application pool gets stopped.

    The error goes as follows:

    Faulting application name: w3wp.exe, version: 7.5.7600.16385, time stamp: 0x4a5bcd2b

    Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdaae

    Exception code: 0xe053534f

    Fault offset: 0x00009617

    Faulting process id: 0x%9

    Faulting application start time: 0x%10

    Faulting application path: %11

    Faulting module path: %12

    My machine is Windows 7 and .NET Framework version is 2.0, I am facing the same issue in version 4.0 also. what could be the reason for this issue?

  • Your blog is really wonderfull

  • The force is strong with you! Great blog!

  • Tess you're awesome.. I love you.. I mean you're article....

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