<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Speaking of which... : ASP.NET</title><link>http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Investigating Locks</title><link>http://blogs.msdn.com/johan/archive/2009/10/09/investigating-locks.aspx</link><pubDate>Fri, 09 Oct 2009 16:49:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9905467</guid><dc:creator>JohanS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/johan/comments/9905467.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=9905467</wfw:commentRss><description>&lt;p&gt;Consider the following scenario:&lt;/p&gt;  &lt;p&gt;You have an ASP.NET application which intermittently responds sluggishly. As the problem occurs memory usage is about average, as is CPU usage, but still certain pages respond slower and slower. The machine acts just as if it is under heavy load, but judging from the CPU it isn't. In fact CPU usage might even &lt;em&gt;decrease&lt;/em&gt; rather than increase. When trying to access non .NET content such as plain text/html or images you usually find that response times are just as fast as ever.&lt;/p&gt;  &lt;p&gt;When you find that your application has hung in a low CPU state it is usually because of one of the following reasons (in order of likelihood based on my experience) :&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;External resources responding slowly. E.g. a database query or AD lookup is taking a long time to complete and so the application is simply waiting for another server to respond. &lt;/li&gt;    &lt;li&gt;One of the threads of the application has entered a critical section and now several other threads are waiting to enter the same critical section. &lt;/li&gt;    &lt;li&gt;A classic deadlock. Thread A waits for thread B which waits for thread C which waits for thread A. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Quite often you'll see a mixture of items 1 and 2. A thread enters a critical section, calls a remote database, or similar, and all other threads attempting to enter the same critical section will have to nicely stay in line until the struggling database has responded. Still, it is quite possible that the critical section is waiting for a local event to finish, but then you'd usually see a higher CPU load on the machine. (Though not necessarily in the w3wp.exe process.)&lt;/p&gt;  &lt;h1&gt;What are Critical Sections?&lt;/h1&gt;  &lt;p&gt;In case you've forgotten or simply not worked that much with critical sections it might be necessary to refresh your memory on this.&lt;/p&gt;  &lt;p&gt;A Critical Section is a segment of code that you do not want to be executed more than one at a time. In order to ensure this you use the &lt;strong&gt;lock&lt;/strong&gt; keyword to ensure that a certain block of code is able to complete with no interruption from any other threads. To illustrate this I've created the following code sample:&lt;/p&gt;  &lt;div class="SampleCode"&gt;   &lt;pre&gt;public class FileIO
{
    private static object myLock = new object();

	public FileIO()
	{
	}

    public string performLockOperation()
    {
        string strResult = &amp;quot;The Lock Operation started on &amp;quot; + System.DateTime.Now.ToLongTimeString();
        lock (myLock)
        {
            // Let the thread sleep for 10 seconds
            // This way we simulate a File IO operation that takes some time to complete.
            System.Threading.Thread.Sleep(10000);
        }
        strResult += &amp;quot; and ended on &amp;quot; + System.DateTime.Now.ToLongTimeString();
        return strResult;
    }

    public string performNoLockOperation()
    {
        string strResult = &amp;quot;The No Lock Operation started on &amp;quot; + System.DateTime.Now.ToLongTimeString();
        System.Threading.Thread.Sleep(10000);
        strResult += &amp;quot; and ended on &amp;quot; + System.DateTime.Now.ToLongTimeString();
        return strResult;
    }

}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Let's take a quick look at the parts of this class that I've written, called FileIO:&lt;/p&gt;

&lt;h2&gt;&lt;/h2&gt;

&lt;h2&gt;myLock&lt;/h2&gt;

&lt;p&gt;The class has a static variable called myLock that I will be using to identify the lock I'm about to create. This is why the variable is static. Otherwise I'd be creating new locks for each instance of the FileIO class leaving the lock operation completely redundant. Now that I use a static variable the lock spans all instances of the FileIO class.&lt;/p&gt;

&lt;h2&gt;constructor&lt;/h2&gt;

&lt;p&gt;The constructor is empty. Move along. Nothing to see here.&lt;/p&gt;

&lt;h2&gt;performLockOperation&lt;/h2&gt;

&lt;p&gt;This is the most interesting part of the class. It is the function we'll be using to actually reproduce the potential problems. The function returns a string which will contain information about when the call to the function was made and when it completed. We store this data in a string called strResult which we will eventually be returning as the result of the function call.&lt;/p&gt;

&lt;p&gt;Having declared this variable and put the initial time of the function call in it we then create our lock. This is simply done with the following syntax:&lt;/p&gt;

&lt;div class="SampleCode"&gt;
  &lt;pre&gt;lock (object)
{
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Any code within this block will first make sure that there is not already a lock taken on this object. If there is, then they will pause execution and wait for the lock to become available before continuing execution.&lt;/p&gt;

&lt;p&gt;Inside our lock we then simulate a slow File IO operation by letting the thread sleep for 10 seconds.&lt;/p&gt;

&lt;p&gt;After that we append the current time to the result and return it.&lt;/p&gt;

&lt;h2&gt;performNoLockOperation&lt;/h2&gt;

&lt;p&gt;This function is identical to the previous one, except this time we do not have a critical section. This function is included just for comparison.&lt;/p&gt;

&lt;h1&gt;The potential problem&lt;/h1&gt;

&lt;p&gt;Now, let's get down to business. If we have a web page that makes a call to the performLockOperation-function and that page is requested at the same time by four different clients. What would be the response times?&lt;/p&gt;

&lt;p&gt;The answer is 10, 20, 30 &amp;amp; 40 seconds.&lt;/p&gt;

&lt;p&gt;Here's why:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The thread handling the first request enters the critical section, effectively locking it for everyone else. When it is complete 10 seconds have passed due to the Sleep-call. &lt;/li&gt;

  &lt;li&gt;One of the other threads enters the critical section once the first request is finished. It has already waited for 10 seconds, and the thread will now sleep for an additional 10 seconds. &lt;/li&gt;

  &lt;li&gt;As the second thread finishes one of the remaining two enters the critical section. It has now waited for 20 seconds and will sleep for an additional 10. &lt;/li&gt;

  &lt;li&gt;The final request is able to enter the critical section after having waited for 30 seconds. Once it is complete 40 seconds have passed. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If we'd been using the performNoLockOperation instead then all requests would have responded after 10 seconds.&lt;/p&gt;

&lt;p&gt;Now, I know that 10 seconds is an exceptionally long time to let the thread sleep, but this was all for illustration purposes. Imagine instead that the sleeping time was 1 second and the number of requests was 200...&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;Troubleshooting this issue&lt;/h1&gt;

&lt;p&gt;Okay, so what would it look like when this problem occurs? Let's have a look. If you haven't looked at my posts on getting started with Windbg, then I suggest reading them before continuing. (&lt;a href="http://blogs.msdn.com/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx"&gt;Part I&lt;/a&gt; &amp;amp; &lt;a href="http://blogs.msdn.com/johan/archive/2008/05/28/powershell-an-introduction-part-ii.aspx"&gt;Part II&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;First of all I fire up WinDbg, then I attach to the w3wp.exe. I then use &amp;quot;~*e!clrstack&amp;quot; to look at the managed threads of the w3wp.exe application. Here is a snippet of what I get:&lt;/p&gt;

&lt;div class="DebugSample"&gt;
  &lt;pre&gt;OS Thread Id: 0xce0 (24)
Child-SP         RetAddr          Call Site
000000000447e0f0 000007ff001e13d2 FileIO.performLockOperation()
000000000447e170 000007feee323ec9 _Default.Page_Load(System.Object, System.EventArgs)
000000000447e1b0 000007fee7956aea System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)
000000000447e1e0 000007fee794d2c4 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)
000000000447e210 000007fee794d322 System.Web.UI.Control.OnLoad(System.EventArgs)
000000000447e250 000007fee79498ac System.Web.UI.Control.LoadRecursive()
000000000447e2a0 000007fee7948db0 System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
000000000447e370 000007fee7948cdb System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
000000000447e3d0 000007fee7948c70 System.Web.UI.Page.ProcessRequest()
000000000447e430 000007ff001e0c09 System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
000000000447e490 000007fee7950117 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
000000000447e4c0 000007fee791449b System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
000000000447e570 000007fee7ffbd41 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
000000000447e610 000007fee7fed132 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
000000000447e7a0 000007fee7fcf599 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
000000000447e7f0 000007fee80f5344 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
000000000447e910 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
000000000447ea80 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
000000000447eae0 000007fef72701ea DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
000000000447f310 000007fee80f5424 DomainNeutralILStubClass.IL_STUB(IntPtr, System.Web.RequestNotificationStatus ByRef)
000000000447f3f0 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
000000000447f560 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
000000000447f5c0 000007fef727043b DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
OS Thread Id: 0x15ec (25)
Unable to walk the managed stack. The current thread is likely not a 
managed thread. You can run !threads to get a list of managed threads in
the process
OS Thread Id: 0x1958 (26)
Child-SP         RetAddr          Call Site
0000000004c1dd10 000007ff001e13d2 FileIO.performLockOperation()
0000000004c1dd90 000007feee323ec9 _Default.Page_Load(System.Object, System.EventArgs)
0000000004c1ddd0 000007fee7956aea System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)
0000000004c1de00 000007fee794d2c4 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)
0000000004c1de30 000007fee794d322 System.Web.UI.Control.OnLoad(System.EventArgs)
0000000004c1de70 000007fee79498ac System.Web.UI.Control.LoadRecursive()
0000000004c1dec0 000007fee7948db0 System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
0000000004c1df90 000007fee7948cdb System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
0000000004c1dff0 000007fee7948c70 System.Web.UI.Page.ProcessRequest()
0000000004c1e050 000007ff001e0c09 System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
0000000004c1e0b0 000007fee7950117 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
0000000004c1e0e0 000007fee791449b System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
0000000004c1e190 000007fee7ffbd41 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
0000000004c1e230 000007fee7fed132 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
0000000004c1e3c0 000007fee7fcf599 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
0000000004c1e410 000007fee80f5344 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
0000000004c1e530 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0000000004c1e6a0 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0000000004c1e700 000007fef72701ea DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
0000000004c1ef30 000007fee80f5424 DomainNeutralILStubClass.IL_STUB(IntPtr, System.Web.RequestNotificationStatus ByRef)
0000000004c1f010 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0000000004c1f180 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0000000004c1f1e0 000007fef727043b DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
OS Thread Id: 0x1e28 (27)
Child-SP         RetAddr          Call Site
000000000492dcf0 000007ff001e13d2 FileIO.performLockOperation()
000000000492dd70 000007feee323ec9 _Default.Page_Load(System.Object, System.EventArgs)
000000000492ddb0 000007fee7956aea System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)
000000000492dde0 000007fee794d2c4 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)
000000000492de10 000007fee794d322 System.Web.UI.Control.OnLoad(System.EventArgs)
000000000492de50 000007fee79498ac System.Web.UI.Control.LoadRecursive()
000000000492dea0 000007fee7948db0 System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
000000000492df70 000007fee7948cdb System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
000000000492dfd0 000007fee7948c70 System.Web.UI.Page.ProcessRequest()
000000000492e030 000007ff001e0c09 System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
000000000492e090 000007fee7950117 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
000000000492e0c0 000007fee791449b System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
000000000492e170 000007fee7ffbd41 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
000000000492e210 000007fee7fed132 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
000000000492e3a0 000007fee7fcf599 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
000000000492e3f0 000007fee80f5344 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
000000000492e510 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
000000000492e680 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
000000000492e6e0 000007fef72701ea DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
000000000492ef10 000007fee80f5424 DomainNeutralILStubClass.IL_STUB(IntPtr, System.Web.RequestNotificationStatus ByRef)
000000000492eff0 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
000000000492f160 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
000000000492f1c0 000007fef727043b DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
OS Thread Id: 0x1c38 (28)
Child-SP         RetAddr          Call Site
0000000004d0e0b0 000007ff001e13d2 FileIO.performLockOperation()
0000000004d0e130 000007feee323ec9 _Default.Page_Load(System.Object, System.EventArgs)
0000000004d0e170 000007fee7956aea System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)
0000000004d0e1a0 000007fee794d2c4 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)
0000000004d0e1d0 000007fee794d322 System.Web.UI.Control.OnLoad(System.EventArgs)
0000000004d0e210 000007fee79498ac System.Web.UI.Control.LoadRecursive()
0000000004d0e260 000007fee7948db0 System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
0000000004d0e330 000007fee7948cdb System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
0000000004d0e390 000007fee7948c70 System.Web.UI.Page.ProcessRequest()
0000000004d0e3f0 000007ff001e0c09 System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
0000000004d0e450 000007fee7950117 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
0000000004d0e480 000007fee791449b System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
0000000004d0e530 000007fee7ffbd41 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
0000000004d0e5d0 000007fee7fed132 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
0000000004d0e760 000007fee7fcf599 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
0000000004d0e7b0 000007fee80f5344 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
0000000004d0e8d0 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0000000004d0ea40 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0000000004d0eaa0 000007fef72701ea DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32)
0000000004d0f2d0 000007fee80f5424 DomainNeutralILStubClass.IL_STUB(IntPtr, System.Web.RequestNotificationStatus ByRef)
0000000004d0f3b0 000007fee80f65bb System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0000000004d0f520 000007fee80f4994 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0000000004d0f580 000007fef727043b DomainNeutralILStubClass.IL_STUB(Int64, Int64, Int64, Int32&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;So, what does this tell us?&lt;/p&gt;

&lt;p&gt;Well, obviously we have four threads that call my function FileIO.performLockOperation() from Page_Load.&lt;/p&gt;

&lt;p&gt;Please note that we don't have any additional callstack, and since the performLockOperation-function was named by me it could just as well have been named &amp;quot;foo&amp;quot;. In order to find out that these threads are actually waiting for a lock we need to look at the native callstack using the kb-command. Let's take a look at thread 24: &lt;/p&gt;

&lt;div class="DebugSample"&gt;
  &lt;pre&gt;0:029&amp;gt; ~24kb
ntdll!NtDelayExecution+0xa
kernel32!SleepEx+0x84
mscorwks!EESleepEx+0x2d
mscorwks!Thread::UserSleep+0x71
mscorwks!&lt;font color="#ff0000"&gt;ThreadNative::Sleep&lt;/font&gt;+0xf9
App_Code_tvh3usvo!&lt;font color="#ff0000"&gt;FileIO.performLockOperation&lt;/font&gt;()+0x8a
App_Web_uywrbugj!_Default.Page_Load(System.Object, System.EventArgs)+0x32
System_Web_RegularExpressions_ni!System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)+0x19
System_Web_ni!System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)+0x2a
System_Web_ni!System.Web.UI.Control.OnLoad(System.EventArgs)+0x84
System_Web_ni!System.Web.UI.Control.LoadRecursive()+0x42
System_Web_ni!System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)+0x97c
System_Web_ni!System.Web.UI.Page.ProcessRequest(Boolean, Boolean)+0xa0
System_Web_ni!System.Web.UI.Page.ProcessRequest()+0x5b
System_Web_ni!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)+0xf0
App_Web_uywrbugj!ASP.default_aspx.ProcessRequest(System.Web.HttpContext)+0x9
System_Web_ni!System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+0x257
System_Web_ni!System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)+0xab
System_Web_ni!System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)+0x501
System_Web_ni!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)+0x72&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apparently we entered FileIO.performLockOperation, and then called sleep, (which is what we're doing in this repro in order to simulate a slow IO operation.) So, what do the other threads look like? Here's thread 26:&lt;/p&gt;

&lt;div class="DebugSample"&gt;
  &lt;pre&gt;0:029&amp;gt; ~26kb
ntdll!ZwWaitForMultipleObjects+0xa
kernel32!WaitForMultipleObjectsEx+0x10b
mscorwks!WaitForMultipleObjectsEx_SO_TOLERANT+0xc1
mscorwks!Thread::DoAppropriateAptStateWait+0x41
mscorwks!Thread::DoAppropriateWaitWorker+0x191
mscorwks!Thread::DoAppropriateWait+0x5c
mscorwks!&lt;font color="#ff0000"&gt;CLREvent::WaitEx&lt;/font&gt;+0xbe
mscorwks!AwareLock::EnterEpilog+0xc9
mscorwks!AwareLock::Enter+0x72
mscorwks!AwareLock::Contention+0x1fb
mscorwks!JITutil_MonContention+0xdf
App_Code_tvh3usvo!&lt;font color="#ff0000"&gt;FileIO.performLockOperation&lt;/font&gt;()+0x7f
App_Web_uywrbugj!_Default.Page_Load(System.Object, System.EventArgs)+0x32
System_Web_RegularExpressions_ni!System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr, System.Object, System.Object, System.EventArgs)+0x19
System_Web_ni!System.Web.Util.CalliEventHandlerDelegateProxy.Callback(System.Object, System.EventArgs)+0x2a
System_Web_ni!System.Web.UI.Control.OnLoad(System.EventArgs)+0x84
System_Web_ni!System.Web.UI.Control.LoadRecursive()+0x42
System_Web_ni!System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)+0x97c
System_Web_ni!System.Web.UI.Page.ProcessRequest(Boolean, Boolean)+0xa0
System_Web_ni!System.Web.UI.Page.ProcessRequest()+0x5b&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This is one of the threads waiting for the critical section. It then found that it was unable to get a lock and so began waiting for the critical section on thread 24 to end.&lt;/p&gt;

&lt;h1&gt;Resolving the problem&lt;/h1&gt;

&lt;p&gt;This is the tricky part. There is no quick-fix for this. We can use the debugger to identify the bottleneck, but after that we'll need to review our design in order to get this working smoothly. A couple of generic things to try would be the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Review what you're doing inside the critical section. Is it really necessary to perform all of the operations you're doing, or would it be possible to do some/all of them outside the scope of the critical section?&lt;/li&gt;

  &lt;li&gt;Identify the reason for the lock taking so much time. Can it be resolved by load-balancing or clustering the resource we're waiting for?&lt;/li&gt;

  &lt;li&gt;If we're waiting for another server, make sure the physical infrastructure is okay. Are network response times within the expected parameters or do you need to fix your wiring, router, etc?&lt;/li&gt;

  &lt;li&gt;Are &lt;em&gt;all &lt;/em&gt;calls to the critical section taking the same amount of time, or are there certain calls that take an &lt;em&gt;exceptional&lt;/em&gt; amount of time? Perhaps most calls to the function are just fine, but intermittently a call comes along that tries to get &lt;em&gt;everything &lt;/em&gt;from the AD, database, etc. In order to investigate this I'd use the commands outlined in &lt;a href="http://blogs.msdn.com/johan/archive/2007/11/26/getting-started-with-windbg-part-ii.aspx"&gt;Getting started with windbg -part II&lt;/a&gt;. Identify the thread owning the lock and investigate the callstack and stack objects using !clrstack and !dso. Use !dso and !do to query the stack objects and try to find the SQL query or AD query that is causing the thread to take such a long time to finish. Is the query significantly different from the ones waiting to execute, then this is most likely our culprit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Post Script&lt;/h1&gt;

&lt;p&gt;A quick thought on locks and their limits:&lt;/p&gt;

&lt;p&gt;Locks do not scale well. A lock can only be made within a specific process, so if you're using a web farm, or in any other way more than one w3wp.exe, then you will not be able to lock &lt;em&gt;all &lt;/em&gt;processes. In other words. Server 1 can get a lock, and so can Server 2. Both will happily execute their code independent of each other. For products such as SQL server you'd deal with this in your SQL query, but if you're performing other operations, such as File IO you might have to work around this by using the same approach as Ms Word. Create a lock file in a shared space, and before you enter your critical section you simply check if the file exists:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;You are entering your critical section. Look for lock file in shared location&lt;/li&gt;

  &lt;li&gt;If file exists, then wait&lt;/li&gt;

  &lt;li&gt;If/when file doesn't/no longer exist, create file and enter critical section&lt;/li&gt;

  &lt;li&gt;Make sure you have &lt;em&gt;solid&lt;/em&gt; exception handling within the critical section so that you under no circumstances leave the critical section without removing the lock file.&lt;/li&gt;

  &lt;li&gt;When done, remove lock file&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9905467" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/johan/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/johan/archive/tags/Debugging+School/default.aspx">Debugging School</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/johan/archive/tags/Hangs/default.aspx">Hangs</category></item><item><title>Office Automation</title><link>http://blogs.msdn.com/johan/archive/2008/10/14/office-automation.aspx</link><pubDate>Tue, 14 Oct 2008 16:15:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8999436</guid><dc:creator>JohanS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/johan/comments/8999436.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8999436</wfw:commentRss><description>&lt;p&gt;A very common scenario that keeps sprouting new heads like a hydra is Office Automation. Let me start by saying that this is &lt;strong&gt;not &lt;/strong&gt;supported.&lt;/p&gt;  &lt;p&gt;There is a KB-article number &lt;a href="http://support.microsoft.com/kb/257757/en-us"&gt;257757&lt;/a&gt; discusses this, and clearly states the following:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.&lt;/strong&gt;&lt;/p&gt;  &lt;h1&gt;&lt;strong&gt;Why is this not supported?&lt;/strong&gt;&lt;/h1&gt;  &lt;p&gt;The crucial thing to consider is the fact that Microsoft Office is designed to be an end-user, single client product. Automating Microsoft Office in a client application, using the identity and security context of the logged on client is supported, but unattended execution is not.&lt;/p&gt;  &lt;p&gt;There are a number of things that can go wrong and article &lt;a href="http://support.microsoft.com/kb/257757/en-us"&gt;257757&lt;/a&gt; lists most of them. For arguments sake, let's consider the following scenario:&lt;/p&gt;  &lt;p&gt;Your server application starts up and uses CreateObject to create an instance of MS Word. Word tries to read the settings of the current client and since your application is using the Network Service account this presents an immediate problem. There are, for example, certain methods that rely on a default printer being installed. All this can lead to serious problems. You then need to monitor the server, since Office might show a modal dialogue for some reason. The &amp;quot;install on first use&amp;quot; feature of MSI might also kick in, prompting the client to install additional features. All this would hang the current thread. Also, running one instance of Word, might be okay, but what happens when you get 100 more or less concurrent requests and each request starts up an instance of Word? MS Word is not a server, it's an excellent piece of single-client software.&lt;/p&gt;  &lt;h1&gt;So what should I do instead?&lt;/h1&gt;  &lt;p&gt;Actually, most of your problems can be resolved using HTML. I've seen applications where lines and lines of complex code were used for generating an Excel document, when it could just as well have been made using a standard HTML-table. Excel would have no problems whatsoever reading a table like the one below:&lt;/p&gt;  &lt;div class="SampleCode"&gt;&amp;lt;table&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Person&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Age&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;Pete&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;30&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;Claire&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;40&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;tr&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;Average age&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;td&amp;gt;=AVERAGE(B2:B3)&amp;lt;/td&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/tr&amp;gt;     &lt;br /&gt;&amp;lt;/table&amp;gt;&lt;/div&gt;  &lt;p&gt;As you can see all formatting, and even the functions, would be interpreted correctly.&lt;/p&gt;  &lt;p&gt;&lt;img src="http://blogs.msdn.com/photos/johan/images/8999380/original.aspx" /&gt; &lt;/p&gt;  &lt;p&gt;Obviously Word is great with HTML as well, so most formatting issues can quite easily be resolved using this approach.&lt;/p&gt;  &lt;h2&gt;So how do I do this?&lt;/h2&gt;  &lt;p&gt;The solution is quite easy. In order to generate an Excel document all you need to do is to create a table with the data you want, and add the following two lines to the Page_Load event of your page:&lt;/p&gt;  &lt;div class="SampleCode"&gt;Response.ContentType = &amp;quot;application/vnd.ms-excel&amp;quot;;    &lt;br /&gt;Response.AddHeader(&amp;quot;Content-Disposition&amp;quot;, &amp;quot;attachment; filename=Data.xls;&amp;quot;);&lt;/div&gt;  &lt;p&gt;The first line, sets the returned ContentType to Excel, and the second changes the filename of the returned file. This means that the client will be prompted to Open/Save the file, and the filename will be set to &amp;quot;Data.xls&amp;quot; rather than &amp;quot;Default.aspx&amp;quot; (or whatever your original document may be called.)&lt;/p&gt;  &lt;p&gt;If you wanted to return a word document you'd set the ContentType to &amp;quot;application/msword&amp;quot; instead.&lt;/p&gt;  &lt;p&gt;One little thing to consider is the fact that by default you're probably adding a lot of redundant information to your webpage. You might want to remove all excessive HTML from the page so that you remove all unnecessary headers, stylesheets, viewstate, etc. For an example, please consider the code below:&lt;/p&gt;  &lt;div class="SampleCode"&gt;Response.Clear();    &lt;br /&gt;Response.Buffer = true;     &lt;br /&gt;Response.ContentType = &amp;quot;application/vnd.ms-excel&amp;quot;;     &lt;br /&gt;Response.AddHeader(&amp;quot;Content-Disposition&amp;quot;, &amp;quot;attachment; filename=Data.xls;&amp;quot;);     &lt;br /&gt;this.EnableViewState = false;     &lt;br /&gt;System.IO.StringWriter oSw = new System.IO.StringWriter();     &lt;br /&gt;System.Web.UI.HtmlTextWriter oHtml = new System.Web.UI.HtmlTextWriter(oSw);     &lt;br /&gt;Table oTable = new Table();     &lt;br /&gt;for (int ctr = 1; ctr &amp;lt;= 10; ctr++)     &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; TableRow oRow = new TableRow();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; TableCell oCell1 = new TableCell();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; oCell1.Text = ctr.ToString();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; TableCell oCell2 = new TableCell();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; oCell2.Text = (ctr*10).ToString();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; oRow.Cells.Add(oCell1);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; oRow.Cells.Add(oCell2);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; oTable.Rows.Add(oRow);     &lt;br /&gt;}     &lt;br /&gt;oTable.RenderControl(oHtml);     &lt;br /&gt;Response.Write(oSw.ToString());     &lt;br /&gt;Response.End();&lt;/div&gt;  &lt;h2&gt;&amp;#160;&lt;/h2&gt;  &lt;h2&gt;Security issues in Office 2007&lt;/h2&gt;  &lt;p&gt;If you're running Office 2007 you might come across the following error message:&lt;/p&gt;  &lt;p&gt;&amp;quot;The file you are trying to open, 'Data.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?&lt;/p&gt;  &lt;p&gt;&amp;lt;Yes&amp;gt; &amp;lt;No&amp;gt; &amp;lt;Help&amp;gt;&lt;/p&gt;  &lt;p&gt;This is completely by design. In this example Excel has noticed that though the file is named .xls it does in fact contain html, so it's warning us about this inconsistency. We might bypass this by actually changing the file extension to htm or, perhaps saving the data as comma separated values (csv) which Excel also supports, but both options would be opened directly in the browser rather than passed on to Excel, so this is a design consideration we have to take into account.&lt;/p&gt;  &lt;p&gt;There is really no way of bypassing this security feature other than manually disabling it, client-side, using a registry hack. (The key is &lt;span class="InlineCode"&gt;HKCU\Software\Microsoft\Office\12.0\Excel\Security\&lt;/span&gt; Add a DWORD named &lt;span class="InlineCode"&gt;xtensionHardening&lt;/span&gt; and set it to 0.) For obvious reasons this is not something that is generally recommended.&lt;/p&gt;  &lt;h2&gt;Other options&lt;/h2&gt;  &lt;p&gt;There are also third-party products available for generating MS Office-compatible documents, but there are also some articles in the knowledge base on the subject. For example this little gem which can easily be adopted to ASP.NET as well:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/270906/en-us"&gt;How to use ASP to generate a Rich Text Format (RTF) document to stream to Microsoft Word&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8999436" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Misc/default.aspx">Misc</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/johan/archive/tags/Automation/default.aspx">Automation</category><category domain="http://blogs.msdn.com/johan/archive/tags/Office/default.aspx">Office</category></item><item><title>Why doesn’t the GC kick in when the worker process is inactive?</title><link>http://blogs.msdn.com/johan/archive/2008/05/13/why-doesn-t-the-gc-kick-in-when-the-worker-process-is-inactive.aspx</link><pubDate>Tue, 13 May 2008 16:39:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8500269</guid><dc:creator>JohanS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/johan/comments/8500269.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8500269</wfw:commentRss><description>&lt;p&gt; &lt;p&gt;I got the following question in my &lt;a href="http://blogs.msdn.com/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx"&gt;Getting started with windbg&lt;/a&gt; – post and I thought it might be worth posting the replies in a separate article:&lt;/p&gt; &lt;p&gt;&lt;em&gt;Hi Johan,&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;about those threads with an ID of XXXX, should they go away after certain amount of idle time like 2 minutes? I am trouble shooting an application while the application should sit idle (because of no stimulation), however it is still using quite some CPU time and and threadpool threads, where it should not. So I created an adplus dump when it is sitting idle, and I found that there are many threads with ID XXXX, and I created a dump file again after 15 minutes, again, it still have the exact same XXXX threads. All those threads are completion port threads, and I wonder why they did not get recycled?&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Also, when doing a '~*e !clrstack', most of the worker threads and completion port threads are showing "Failed to start stack walk: 80004005". Is there a way to show the stack for those threads, because those are the threads I am interested in.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Thank you!&lt;/em&gt;&lt;/p&gt; &lt;hr&gt;  &lt;p&gt;The GC will be triggered when you’re allocating memory. If your application is inactive, then so is the Garbage Collector. Even if you’re making a few, random allocations they still may not be enough to trigger a GC, so this is not at all unexpected.&lt;/p&gt; &lt;p&gt;The “Failed to start stack walk: 80004005”-error is displayed when the thread &lt;em&gt;did &lt;/em&gt;contain a managed stack, but no longer does.&lt;/p&gt; &lt;p&gt;/ Johan &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8500269" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/johan/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/johan/archive/tags/Managed+Heap/default.aspx">Managed Heap</category><category domain="http://blogs.msdn.com/johan/archive/tags/GC/default.aspx">GC</category><category domain="http://blogs.msdn.com/johan/archive/tags/Worker+Process/default.aspx">Worker Process</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>What to do about the slow startup of web services</title><link>http://blogs.msdn.com/johan/archive/2008/04/02/what-to-do-about-the-slow-startup-of-web-services.aspx</link><pubDate>Wed, 02 Apr 2008 18:05:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8351640</guid><dc:creator>JohanS</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/johan/comments/8351640.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8351640</wfw:commentRss><description>&lt;p&gt;Due to the architecture of web services and web applications they can be quite slow to start. For example on my Windows 2003-box the initial localhost-call to a simple “Hello World!”-web service takes approximately 8 seconds, while the next request is more or less immediate.&lt;/p&gt; &lt;h1&gt;Why is this?&lt;/h1&gt; &lt;p&gt;This isn’t news, really. One of the first things we learned in the early beta stages of ASP.NET was that the first request would take a little extra time due to the &lt;em&gt;Just In Time Compilation &lt;/em&gt;(JIT). This was a major change from the classic ASP architecture where everything was interpreted rather than compiled. Upon the first request the .aspx / .asmx file will be compiled (JIT’ed) into Microsoft Immediate Language (MSIL) and the resulting .dll will be moved to it’s proper location.&lt;/p&gt; &lt;p&gt;This compilation will occur every time the application pool starts causing a significantly longer response time on the first request compared to the following requests.&lt;/p&gt; &lt;h2&gt;Run-time performance over startup performance&lt;/h2&gt; &lt;p&gt;It all comes down to prioritizing run-time performance over a quick startup. Which, in my humble opinion, is a sound choice. There are, however, situations where you may feel that this is to your disadvantage. The other day I got a question from a customer who had a web service that was called quite infrequently and to him this meant that with every other request response times would be horrendous, simply because the application got recompiled.&lt;/p&gt; &lt;p&gt;For each case I get I usually do a quick search on the problem description. I don’t really expect to find the solution this way, since I can only assume that the customer has tried this as well. Instead it will likely present me with a list of troubleshooting steps that the customer has already tried as well as possible solutions that &lt;em&gt;didn’t &lt;/em&gt;fit. (Off course I still need to verify this with the customer).&lt;/p&gt; &lt;p&gt;This time I didn’t really need to do this since I was pretty sure what the cause was. Still, I was curious to see how &lt;em&gt;common&lt;/em&gt; this problem was. I honestly didn’t think this was a very common scenario, but my quick search on the web revealed the contrary. The few hits that I quickly browsed through suggested writing an application that would ping the web service in order to keep it alive. I must admit I find this quite inventive, but I really don’t think it’s the best approach. :)&lt;/p&gt; &lt;h1&gt;What to do&lt;/h1&gt; &lt;p&gt;So, what is to be done about this? Well, I’ve already mentioned that there are better solutions than pinging the web service. As I told my customer there are basically two good options:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Precompile the assemblies  &lt;li&gt;Change the settings for automatic recycling on the worker process&lt;/li&gt;&lt;/ol&gt; &lt;h2&gt;Precompiling the assemblies&lt;/h2&gt; &lt;p&gt;There is a nice little tool called Native Image Generator. (ngen.exe) It will compile the assembly into native images and installs them into the native image cache. The syntax is pretty straight-forward: &lt;span class="InlineCode"&gt;ngen.exe install [assembly]&lt;/span&gt; The problem is that once you’ve changed the assembly you’d have to precompile it again making updates a bit tedious.&lt;/p&gt; &lt;p&gt;There is also a service-version of the ngen called the Native Image Service. More information about ngen can be found at &lt;a title="http://msdn2.microsoft.com/sv-se/magazine/cc163808(en-us).aspx" href="http://msdn2.microsoft.com/sv-se/magazine/cc163808(en-us).aspx"&gt;http://msdn2.microsoft.com/sv-se/magazine/cc163808(en-us).aspx&lt;/a&gt;&lt;/p&gt; &lt;h2&gt;Changing the recycling settings&lt;/h2&gt; &lt;p&gt;The reason why my customer was experiencing this problem was because his application pool would time out and recycle itself due to the default settings in the IIS manager. By default the worker process will recycle after 20 minutes of inactivity, so if no one has pinged your application in that time the next request will cause the application to recompile, resulting in a longer response time. By tweaking this setting in the IIS manager to something more suitable to the current rate of requests, like 40 minutes or maybe even 60 he should also be able to find a nice balance. Actually, considering the low load it would probably be a good idea to turn this setting off completely. Here’s how:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Open up IIS Manager&lt;/li&gt; &lt;li&gt;Locate the Application Pool in question&lt;/li&gt; &lt;li&gt;Right-click it and select “Properties”&lt;/li&gt; &lt;li&gt;Go to the “Performance”-tab&lt;/li&gt; &lt;li&gt;Change, or disable the “Idle timeout” setting&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;img src="http://blogs.msdn.com/photos/johan/images/8351583/original.aspx"&gt; &lt;/p&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8351640" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/johan/archive/tags/Misc/default.aspx">Misc</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/johan/archive/tags/Web+Services/default.aspx">Web Services</category></item><item><title>Using IE6 With Visual Studio 2008</title><link>http://blogs.msdn.com/johan/archive/2008/03/26/using-ie6-with-visual-studio-2008.aspx</link><pubDate>Wed, 26 Mar 2008 19:04:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337937</guid><dc:creator>JohanS</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/johan/comments/8337937.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8337937</wfw:commentRss><description>&lt;p&gt;Here's a little scenario I came across the other day. I've forwarded the information to development, so it's pending further investigation. I still thought it would be a good idea to publish the scenario though.&lt;/p&gt; &lt;h1&gt;Visual Studio 2008 +&amp;nbsp;FTP = Possible trouble&lt;/h1&gt; &lt;p&gt;It seems like there might be a bug in&amp;nbsp;Visual Studio 2008 when it comes to projects that you access via FTP. I don't know how common it is to use FTP to access &amp;amp; deploy your projects. It would be really interesting to see some genuine statistics, but since FTP is highly insecure I guess it is very rarely used. This, I guess, is probably the reason why this little glitch slipped through in the first place.&lt;/p&gt; &lt;h2&gt;File change notification works fine...&lt;/h2&gt; &lt;p&gt;Consider the following scenario:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;You're working on a web project using FTP  &lt;li&gt;You've downloaded a file to your local cache and you're doing some changes.  &lt;li&gt;Another client changes the file  &lt;li&gt;You attempt to save the file, but the original file on the server has changed so it no longer matches the one in your local cache.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This causes a warning to pop up with the following information:&lt;/p&gt; &lt;p&gt;&lt;span class="InlineCode"&gt;A more recent version of the file&amp;nbsp;[File Name] has been saved to the web on '[Date]' . Do you want to replace the server file with your local file?&lt;/span&gt;&lt;/p&gt; &lt;h2&gt;...overwriting the file doesn't&lt;/h2&gt; &lt;p&gt;Clicking Yes you'd now expect Visual Studio to simply overwrite the file on the server. Unfortunately this is where the glitch rears it's ugly head. Instead of overwriting the file it gives you the following error message:&lt;/p&gt; &lt;p&gt;&lt;span class="InlineCode"&gt;Cannot save the file [File Name] to the Webserver. The file [File Name] has been modified by (unknown) on&amp;nbsp;[Date] [Time Zone].&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Continuous attempts at saving will have no effect. The error pattern will repeat, displaying the two dialogue boxes over and over again.&lt;/p&gt; &lt;h2&gt;Alternative solution&lt;/h2&gt; &lt;p&gt;My customer originally fixed this by selecting everything in the editor, copying it to Notepad, canceling the operation in Visual Studio, reopening the connection, pasting the contents from Notepad into the document and saving. Fortunately there's an easier way to resolve it.&lt;/p&gt; &lt;p&gt;Simply click&amp;nbsp;the Refresh-button in the Project Explorer window. Visual Studio will then ask you if you wish to update your cached version of the files you've edited. This may sound like you're going to perform a revert-to-save operation on the pages you've edited, undoing all the changes, but it's actually not the case. Visual Studio will simply refresh the files in the &lt;em&gt;cache&lt;/em&gt;, not the ones in the &lt;em&gt;editor&lt;/em&gt;. When Visual Studio has finished refreshing the cache it will notice the inconsistency between the files asking you if you want to update the file in the editor as well. At &lt;em&gt;this&lt;/em&gt; point you should answer "No", unless you want all your changes undone.&lt;/p&gt; &lt;h2&gt;My thoughts about this&lt;/h2&gt; &lt;p&gt;Obviously this shouldn't happen. You shouldn't have to refresh the cache in order to overwrite the files. Still, as I mentioned before I believe there are two reasons why this problem managed to slip through the cracks.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;FTP is unsafe. Even the password is sent as clear text and can be intercepted by anyone. For this reason I would assume that FTP is quite rarely used.  &lt;li&gt;In order for the problem to occur you need to trigger a file change notification on the file in question. For normal scenarios this would mean that another client accesses the FTP-site at the same time and changes the file as you're working on it. This type of on-the fly editing without any form of source-control would be highly risky in a production environment and you'd most likely use some other means of connection while in development.&lt;/li&gt;&lt;/ul&gt; &lt;h1&gt;Visual Studio 2008 + FTP + Internet Explorer 6 = More trouble&lt;/h1&gt; &lt;p&gt;Unfortunately the problem doesn't end there.&lt;/p&gt; &lt;p&gt;It turns out that if you are using Visual Studio 2008, are working on a web project using FTP and have IE6 on your machine, then IE will act as if a file change notification has occurred after 90 seconds wether this is true or not. This means that after 90 seconds all your attempts to save will trigger the behavior described above. The refresh cache-approach still works, but it will quickly become quite tedious.&lt;/p&gt; &lt;p&gt;According to the prerequisites for Visual Studio 2008, Internet Explorer 6 is a minimum requirement, so there is nothing documented on IE7 being a necessity in order to run Visual Studio 2008.&lt;/p&gt; &lt;h2&gt;Alternative solution&lt;/h2&gt; &lt;p&gt;So far I only know of one way to resolve this. Install IE7. You'll still encounter the first potential problem if you have more than one client working simultaneously on the same application, but as I've already mentioned, this sounds like a very&amp;nbsp;unlikely scenario.&lt;/p&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8337937" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Bugs/default.aspx">Bugs</category><category domain="http://blogs.msdn.com/johan/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Monitoring Application Pool and Application Restarts</title><link>http://blogs.msdn.com/johan/archive/2008/02/18/monitoring-application-pool-and-application-restarts.aspx</link><pubDate>Mon, 18 Feb 2008 17:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7774295</guid><dc:creator>JohanS</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/johan/comments/7774295.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7774295</wfw:commentRss><description>&lt;P&gt;This morning I found the following in my inbox:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I had set my web servers running on IIS 6 to recycle if they hit 700 MB (Maximum used Memory).&lt;BR&gt;&lt;/EM&gt;&lt;EM&gt;Can I run a report to know how many times per day or week the W3WP got recycled.&lt;BR&gt;&lt;/EM&gt;&lt;EM&gt;Any suggestions please.&lt;BR&gt;&lt;BR&gt;&lt;/EM&gt;&lt;EM&gt;Thanks in anticipation&lt;/EM&gt;&lt;/P&gt;
&lt;HR&gt;

&lt;P&gt;The quick answer to your question is to use performance monitor:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Start performance monitor 
&lt;LI&gt;Add a new counter 
&lt;LI&gt;Performance object: "ASP.NET v[n]" 
&lt;LI&gt;Counter: "Worker Process Restarts"&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;So, there's the answer. But while we're on the subject I'd like to mention &lt;EM&gt;application &lt;/EM&gt;restarts as well.&lt;/P&gt;
&lt;H1&gt;Applications vs. Application pools&lt;/H1&gt;
&lt;P&gt;Application restarts may lead you think that your entire &lt;EM&gt;application pool &lt;/EM&gt;recycled, while in fact it was only one of the applications &lt;EM&gt;hosted &lt;/EM&gt;by the application pool that restarted. If this is getting confusing, then please remember that there's a difference between application pools and application. An application pool will consist of one or several worker processes and may host one or several applications&lt;EM&gt;.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;There are two easy ways of monitoring application restarts:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Using performance monitor again 
&lt;LI&gt;Have ASP.NET write an event to the event log upon shutdown &amp;amp; startup. (Requires ASP.NET 2.0 or later)&lt;/LI&gt;&lt;/UL&gt;
&lt;H2&gt;Performance monitor&lt;/H2&gt;
&lt;P&gt;This is probably the easiest, though you won't get too much additional information other than the fact that an application restart occurred. Here's what you do:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Start performance monitor 
&lt;LI&gt;Add a new counter 
&lt;LI&gt;Performance object: "ASP.NET v[n]" 
&lt;LI&gt;Counter: "Application Restarts"&lt;/LI&gt;&lt;/OL&gt;
&lt;H2&gt;Event log&lt;/H2&gt;
&lt;P&gt;By altering the root web.config you can get an event for every application shutdown and start up. This is a good way to get more detailed information on &lt;EM&gt;why&lt;/EM&gt; the application shut down.&lt;/P&gt;
&lt;P&gt;Open up the root web.config, (located in the &lt;SPAN class=InlineCode&gt;%WinDir%\Microsoft.NET\Framework\v2.0.50727\CONFIG&lt;/SPAN&gt; directory,) locate the healthMonitoring.rules subkey and add the following:&lt;/P&gt;
&lt;DIV class=SampleCode&gt;&amp;lt;add name="Application Lifetime Events Default" eventName="Application Lifetime Events"&lt;BR&gt;provider="EventLogProvider" profile="Default" minInstances="1"&lt;BR&gt;maxLimit="Infinite" minInterval="00:01:00" custom="" /&amp;gt;&lt;/DIV&gt;
&lt;P&gt;Now when the application exited for an application-specific reason you'll get an event like this:&lt;/P&gt;
&lt;DIV class=InlineCode&gt;&lt;PRE&gt;Event code: 1002 
Event message: Application is shutting down. Reason: Configuration changed. 
Event time: 2/14/2008 10:00:41 AM 
Event time (UTC): 2/14/2008 9:00:41 AM 
Event ID: a1314c10a0c84222ae2d870d85308304 
Event sequence: 18 
Event occurrence: 1 
Event detail code: 50004 
 
Application information: 
    Application domain: /LM/w3svc/1/ROOT/Test-1-128474532435626182 
    Trust level: Full 
    Application Virtual Path: /Test
    Application Path: c:\inetpub\wwwroot\Test\ 
    Machine name: JOHAN&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;As you can see the application shut down because the configuration changed. Note that you won't get an event if you manually kill the entire application pool in IIS manager, or similar. One thing that you &lt;EM&gt;will &lt;/EM&gt;get, however, is the following event each and every time the application starts up again:&lt;/P&gt;
&lt;DIV class=InlineCode&gt;&lt;PRE&gt;Event code: 1001 
Event message: Application is starting. 
Event time: 2/14/2008 10:00:47 AM 
Event time (UTC): 2/14/2008 9:00:47 AM 
Event ID: 1f41fd3b17764330ac61804094b0abf0 
Event sequence: 1 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/w3svc/1/ROOT/Test-1-128474532435626182 
    Trust level: Full 
    Application Virtual Path: /Test
    Application Path: c:\inetpub\wwwroot\Test\ 
    Machine name: JOHAN&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;So even if the application shut down for a reason that didn't generate an event, (IISReset, idle server, etc.) you'll at least see that for some reason it had to start up again.&lt;/P&gt;
&lt;P&gt;/ Johan&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7774295" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/johan/archive/tags/Worker+Process/default.aspx">Worker Process</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Did you know? - Changing ASP.NET Version restarts IIS</title><link>http://blogs.msdn.com/johan/archive/2008/02/05/did-you-know-changing-asp-net-version-restarts-iis.aspx</link><pubDate>Tue, 05 Feb 2008 15:09:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7464045</guid><dc:creator>JohanS</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/johan/comments/7464045.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7464045</wfw:commentRss><description>&lt;p&gt;Here's a little something I learned the other day.&lt;/p&gt; &lt;p&gt;If you go to the ASP.NET tab and change the ASP.NET version&amp;nbsp;for an application pool this will not only reset the application pool, but the entire IIS. I was a bit surprised at first, but investigating the matter showed that there was a pretty solid architectural decision behind this.&lt;/p&gt; &lt;p&gt;As most "bugs" this turned out to be quite well documented once you know where to look. It's actually mentioned in the aspnet_regiis documentation.&lt;/p&gt; &lt;p&gt;The reason it is documented under aspnet_regiis is because this is also a rather good alternative if you wish to reconfigure an application pool, but &lt;em&gt;not&lt;/em&gt; cause an IIS reset.&lt;/p&gt; &lt;p&gt;You do it by running the following two commands:&lt;/p&gt; &lt;div class="SampleCode"&gt;aspnet_regiis -s w3svc/&amp;lt;instance&amp;gt;/root -norestart&lt;br&gt;iisapp /a &lt;app pool&gt;/r&lt;/div&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7464045" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Worker+Process/default.aspx">Worker Process</category><category domain="http://blogs.msdn.com/johan/archive/tags/Did+you+know_3F00_/default.aspx">Did you know?</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Debugging School</title><link>http://blogs.msdn.com/johan/archive/2008/02/01/debugging-school.aspx</link><pubDate>Fri, 01 Feb 2008 17:44:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7375007</guid><dc:creator>JohanS</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/johan/comments/7375007.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7375007</wfw:commentRss><description>&lt;p&gt;As you may or may not have noticed I've started organizing all posts I've made regarding debugging training in a separate list on the left hand side of the page. If you're new to debugging and don't know where to begin, then at least you know where &lt;em&gt;I'd &lt;/em&gt;recommend you to start.&lt;/p&gt; &lt;p&gt;I hope you'll find it useful.&lt;/p&gt; &lt;p&gt;Have a great weekend! / Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7375007" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Using WinDbg - Hunting Exceptions</title><link>http://blogs.msdn.com/johan/archive/2008/01/31/using-windbg-hunting-exceptions.aspx</link><pubDate>Thu, 31 Jan 2008 19:39:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7353486</guid><dc:creator>JohanS</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/johan/comments/7353486.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7353486</wfw:commentRss><description>&lt;h1&gt;Prerequisites&lt;/h1&gt; &lt;p&gt;This post will require some basic knowledge of windbg and the sos extension. For this I recommend looking at the following posts:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx"&gt;Getting started with WinDbg - Part I&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/johan/archive/2007/11/26/getting-started-with-windbg-part-ii.aspx"&gt;Getting started with WinDbg - Part II&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;For more information on Exceptions in general and why they should be avoided&amp;nbsp;I'd like to recommend this post:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/johan/archive/2008/01/18/exceptions.aspx"&gt;Exceptions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h1&gt;Introduction&lt;/h1&gt; &lt;p&gt;I thought it was time to write another post on how to use windbg for troubleshooting. A lot of my time is spent locating exceptions in various web applications, so I thought this might be a good topic to cover. I've previously written a &lt;a href="http://blogs.msdn.com/johan/archive/2007/01/11/i-am-getting-outofmemoryexceptions-how-can-i-troubleshoot-this.aspx"&gt;post&lt;/a&gt; specifically targeting OutOfMemoryExceptions, but I thought I should broaden the terms and make it a bit more general. There are two scenarios that are exceptionally common in my line of work:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Clients are reporting 2nd chance exceptions displayed on screen with the classic "Server Error"- page.  &lt;li&gt;Performance is generally bad, and when we investigate it turns out that there are tons of exceptions being thrown every second.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;In this post I'll cover how to investigate what exceptions have been thrown by an application, as well as how to use windbg and adplus to automatically gather specific information for us.&lt;/p&gt; &lt;h1&gt;Where to start&lt;/h1&gt; &lt;p&gt;Okay, so you have a web application that you've been monitoring and you believe it is throwing a lot of exceptions. You've taken a dump of the process and you're ready to begin the investigation. Where do you start?&lt;/p&gt; &lt;h2&gt;!dumpallexceptions (!dae)&lt;/h2&gt; &lt;p&gt;If your application is running under the .NET Framework 1.1 you can use the !dumpallexceptions-command (!dae) to get a list of all the exceptions still on the heap. Now, remember that an exception is a managed object, so they will eventually be garbage collected just like everything else. This means that when looking at the heap for exceptions you will only get the exceptions still in memory, not every exception thrown by the application since startup.&lt;/p&gt; &lt;p&gt;Anyway, if you run !dae you'll get a list of exceptions that looks like this:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !dae&lt;br&gt;Going to dump the .NET Exceptions found in the heap.&lt;br&gt;Loading the heap objects into our cache.&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br&gt;Exception object: 026200ec&lt;br&gt;Exception type: System.ExecutionEngineException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&lt;none&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80131506&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br&gt;Exception object: 026200a4&lt;br&gt;Exception type: System.StackOverflowException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&lt;none&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 800703e9&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br&gt;Exception object: 0262005c&lt;br&gt;Exception type: System.OutOfMemoryException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&lt;none&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 8007000e&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br&gt;Exception object: 0b62cf38&lt;br&gt;Exception type: System.Data.SqlClient.SqlException&lt;br&gt;Message: Transaction (Process ID 96) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACECA8 1D0A4D4C Company.Database.AuditTrail.Write(System.String, System.Guid, System.String)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACED6C 1D0A4B98 Company.Database.AuditTrail.AddEntry(EntryType, System.Guid, System.String)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACED90 1D0A4B24 Company.Database.DataFunctions.SaveRow(System.String, System.Guid, Boolean)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE20 1DDD7A06 FooBase.PersonApplicationOtherQualificationBase.PersonApplicationOtherQualificationBaseManager.BaseSave(System.Guid, Boolean)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE34 1DDD79BF Foo.PersonApplicationOtherQualification.PersonApplicationOtherQualificationManager.Save(System.Guid, Boolean)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE48 1DDD77F5 UserControls.PersonApplicationOtherQualificationDetail.OnSave()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE70 1DDD2701 Company.Web.UI.Page.InvokeUsercontrolTransaction(System.Web.UI.Control, Company.Web.TransactionType)&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80131904&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;br&gt;Exception object: 0b62d23c&lt;br&gt;Exception type: System.Exception&lt;br&gt;Message: Thrown while invoking Save on object PersonApplicationOtherQualificationDetail1(ASP.sys_modules_person_personapplicationotherqualificationdetail_ascx)&lt;br&gt;InnerException: System.Data.SqlClient.SqlException, use !PrintException 0b62cf38 to see more&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEDF8 1DDD28C8 Company.Web.UI.Page.InvokeUsercontrolTransaction(System.Web.UI.Control, Company.Web.TransactionType)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEEC4 1DDD262D Company.Web.UI.Page.InvokeUsercontrolTransaction(System.Web.UI.Control, Company.Web.TransactionType)&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80131500&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;br&gt;Exception object: 03c6fbb8&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F15E3E0 795FC73C System.Guid..ctor(System.String)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F15E43C 1D0AB97F Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36&lt;br&gt;Exception object: 02620134&lt;br&gt;Exception type: System.Threading.ThreadAbortException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&lt;none&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80131530&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 116&lt;br&gt;Exception object: 0396692c&lt;br&gt;Exception type: System.Web.HttpUnhandledException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;InnerException: System.NullReferenceException, use !PrintException 03966878 to see more&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6DF58 6614FDB2 System.Web.UI.Page.HandleError(System.Exception)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6DFA0 6615681A System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EF10 66154A8A System.Web.UI.Page.ProcessRequest(Boolean, Boolean)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EF48 66154967 System.Web.UI.Page.ProcessRequest()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EF80 66154887 System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EF88 6615481A System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EF9C 1C741EAE ASP.sys_pages_application_application_aspx.ProcessRequest(System.Web.HttpContext)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EFA8 65FF27D4 System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EFDC 65FC15B5 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004005&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Number of exceptions of this type:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 136&lt;br&gt;Exception object: 03966878&lt;br&gt;Exception type: System.NullReferenceException&lt;br&gt;Message: Object reference not set to an instance of an object.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EC2C 1C745B38 Pages.Application.Page_Load(System.Object, System.EventArgs)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00000000 00000001 System.EventHandler.Invoke(System.Object, System.EventArgs)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6ED34 66143A84 System.Web.UI.Control.OnLoad(System.EventArgs)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6ED44 66143AD0 System.Web.UI.Control.LoadRecursive()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6ED58 66155106 System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;-----------------&lt;br&gt;&lt;br&gt;Total 303 exceptions&lt;/div&gt; &lt;p&gt;As you can see the !dae-command lists all exception types found on the heap. If possible it also gives us a callstack for each exception. Please note, however, that this doesn't mean that the call stack is more or less the same for &lt;em&gt;all&lt;/em&gt; exceptions. In the sample above you might have ~20 different callstacks leading to the 136 NullReferenceExceptions you see.&lt;/p&gt; &lt;p&gt;Unfortunately the !dae command is not available in version 2.0 of sos.dll. Still, it's quite easy to get (more or less) the same result by using the !dumpheap command. If we just type &lt;span class="InlineCode"&gt;"!dumpheap -type Exception"&lt;/span&gt; we'll get a list of all objects with the string "Exception" in their class name. This is almost as good.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !dumpheap -type Exception -stat&lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;total 79 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;total 76 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 2&lt;br&gt;total 91 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 3&lt;br&gt;total 92 objects&lt;br&gt;------------------------------&lt;br&gt;total 338 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;790ff624&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36 System.Text.DecoderExceptionFallback&lt;br&gt;790ff5d8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36 System.Text.EncoderExceptionFallback&lt;br&gt;790f9ad4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 System.ExecutionEngineException&lt;br&gt;790f9a30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 System.StackOverflowException&lt;br&gt;790f998c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72 System.OutOfMemoryException&lt;br&gt;653c8d04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76 System.Data.SqlClient.SqlException&lt;br&gt;790f984c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 216 System.Exception&lt;br&gt;66414de0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 216 System.Web.HttpApplication+CancelModuleException&lt;br&gt;7911bc7c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 352 System.UnhandledExceptionEventHandler&lt;br&gt;7911a3b0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 608 System.ArgumentNullException&lt;br&gt;790f9b78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2592 System.Threading.ThreadAbortException&lt;br&gt;663d9268&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 116&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9744 System.Web.HttpUnhandledException&lt;br&gt;7915cf40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 136&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9792 System.NullReferenceException&lt;br&gt;Total 338 objects&lt;/div&gt; &lt;p&gt;As you can see, this gives us almost the same information except for the callstacks.&lt;/p&gt; &lt;h2&gt;&lt;/h2&gt; &lt;h1&gt;Knowing what to ignore&lt;/h1&gt; &lt;p&gt;When analyzing data it is always good to know how to filter the information.&lt;/p&gt; &lt;h2&gt;The ever-present exceptions&lt;/h2&gt; &lt;p&gt;There are a three exceptions that are created as soon as the worker process starts. This means that you will &lt;em&gt;always &lt;/em&gt;see them on the heap even if they haven't been thrown at all.:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;System.ExecutionEngineException  &lt;li&gt;System.StackOverflowException  &lt;li&gt;System.OutOfMemoryException&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So why are they created if we haven't thrown them? - Any guesses?&lt;/p&gt; &lt;p&gt;The answer is quite simple: If you run into a situation where you need to throw any of these exceptions you will probably be in a state where you can't create them. For example, you've run out of memory and are no longer able to allocate even the tiniest string. How would you then be able to allocate enough memory to create a new exception?&lt;/p&gt; &lt;p&gt;So, provided that there's&amp;nbsp;still only one of each on the heap, you can most likely ignore these three exceptions. When it comes to ExecutionEngineExceptions and OutOfMemoryExceptions you will probably have a pretty good idea that this is what you're looking for, and finding a StackOverflowException isn't that hard. If you run !clrstack and find a callstack of 200+ lines you can be more or less certain that this is your problem.&lt;/p&gt; &lt;h2&gt;System.Threading.ThreadAbortException&lt;/h2&gt; &lt;p&gt;Usually when you see a&amp;nbsp;ThreadAbortExceptions it is because you've called Response.Redirect.&lt;/p&gt; &lt;p&gt;Whenever you call Response.Redirect, this will also result in a call to Response.End. This will terminate the thread prematurely, resulting in a System.Threading.ThreadAbortException. See the callstack below for an example.&lt;/p&gt; &lt;div class="DebugSample"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1ED6F37C 793D74D0 mscorlib_ni!System.Threading.Thread.Abort(System.Object)+0x2c&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1ED6F390 6600CA8C System_Web_ni!System.Web.HttpResponse.End()+0x5c&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1ED6F3A4 6600B8C3 System_Web_ni!System.Web.HttpResponse.Redirect(System.String, Boolean)+0x1f3&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1ED6F3B8 6600B6B7 System_Web_ni!System.Web.HttpResponse.Redirect(System.String)+0x7&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1ED6F3BC 1DDD2E1D Company_Web!Company.Web.UI.Page.RedirectToPreviousPage()+0x125&lt;br&gt;&lt;/div&gt; &lt;p&gt;Obviously I'm not saying you should discard &lt;em&gt;all&lt;/em&gt; System.Threading.ThreadAbortExceptions as irrelevant. Even if you have no reason to believe that ThreadAbortExceptions are a major concern it's always a good idea to investigate a few of them. Take a minute or two&amp;nbsp;to confirm that there is an underlying call to Response.End caused by a Response.Redirect. Once you think that you have enough statistical data to imply that the ThreadAbortExceptions are caused by Redirects you can move on.&lt;/p&gt; &lt;h1&gt;Examining the Exceptions&lt;/h1&gt; &lt;p&gt;Okay, so say we want to look at the callstacks for the System.Data.SqlClient.SqlException, well first of all we need the address for it. As you might remember, this is easily obtained by using !dumpheap without the -stat option.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !dumpheap -type System.Data.SqlClient.SqlException&lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 2&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;&lt;font color="#ff0000"&gt;0b62cf38&lt;/font&gt; 653c8d04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 1 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 3&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;total 1 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;653c8d04&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76 System.Data.SqlClient.SqlException&lt;br&gt;Total 1 objects&lt;br&gt;&lt;/div&gt; &lt;p&gt;Now we have the address for the exception. In order to investigate the exception we &lt;em&gt;could &lt;/em&gt;use !dumpobject, but there is another command I want to use first.&lt;/p&gt; &lt;h2&gt;!printexception (!pe)&lt;/h2&gt; &lt;p&gt;Running the !printexception command on the address of an exception will give us some neat information on the exception in question. Here's the result of running !printexception on the SqlException:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !pe 0b62cf38 &lt;br&gt;Exception object: 0b62cf38&lt;br&gt;Exception type: System.Data.SqlClient.SqlException&lt;br&gt;Message: Transaction (Process ID 96) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACECA8 1D0A4D4C Company_Database_1d3c0000!Company.Database.AuditTrail.Write(System.String, System.Guid, System.String)+0x194&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACED6C 1D0A4B98 Company_Database_1d3c0000!Company.Database.AuditTrail.AddEntry(EntryType, System.Guid, System.String)+0x48&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACED90 1D0A4B24 Company_Database_1d3c0000!Company.Database.DataFunctions.SaveRow(System.String, System.Guid, Boolean)+0x5e4&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE20 1DDD7A06 FooBase_1d560000!FooBase.PersonApplicationOtherQualificationBase.PersonApplicationOtherQualificationBaseManager.BaseSave(System.Guid, Boolean)+0x2e&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE34 1DDD79BF Foo_1cfd0000!Foo.PersonApplicationOtherQualification.PersonApplicationOtherQualificationManager.Save(System.Guid, Boolean)+0x27&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE48 1DDD77F5 Foo_1cfd0000!UserControls.PersonApplicationOtherQualificationDetail.OnSave()+0x65&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DACEE70 1DDD2701 Company_Web_1d090000!Company.Web.UI.Page.InvokeUsercontrolTransaction(System.Web.UI.Control, Company.Web.TransactionType)+0x1d1&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80131904&lt;br&gt;The current thread is unmanaged&lt;br&gt;&lt;/div&gt; &lt;p&gt;This is good stuff. The command was even able to generate a callstack for us.&amp;nbsp;(This may not always be the case, since the callstack may very well have gone out of scope.) &lt;/p&gt; &lt;h2&gt;!dumpobject (!do) still has its uses&lt;/h2&gt; &lt;p&gt;I wouldn't say that !printexception is a complete replacement for !dumpobject when it comes to examining exceptions. !Printexception will fit the exception into a standard template, and since some exceptions may contain more data than others we sometimes want to use !dumpobject as well. The SqlException has a property called _errors that contains a System.Data.SqlClient.SqlErrorCollection that we might want to look at. This is not in the listing above, so we need to use !dumpobject to look at it.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !do 0b62cf38 &lt;br&gt;Name: System.Data.SqlClient.SqlException&lt;br&gt;MethodTable: 653c8d04&lt;br&gt;EEClass: 6540a0d0&lt;br&gt;Size: 76(0x4c) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll)&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790f9244&amp;nbsp; 40000b5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _className&lt;br&gt;79107d4c&amp;nbsp; 40000b6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 ...ection.MethodBase&amp;nbsp; 0 instance 00000000 _exceptionMethod&lt;br&gt;790f9244&amp;nbsp; 40000b7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _exceptionMethodString&lt;br&gt;790f9244&amp;nbsp; 40000b8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 0b62cdfc _message&lt;br&gt;79112734&amp;nbsp; 40000b9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14 ...tions.IDictionary&amp;nbsp; 0 instance 0b62cf84 _data&lt;br&gt;790f984c&amp;nbsp; 40000ba&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Exception&amp;nbsp; 0 instance 00000000 _innerException&lt;br&gt;790f9244&amp;nbsp; 40000bb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _helpURL&lt;br&gt;790f8a7c&amp;nbsp; 40000bc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object&amp;nbsp; 0 instance 0b62d030 _stackTrace&lt;br&gt;790f9244&amp;nbsp; 40000bd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _stackTraceString&lt;br&gt;790f9244&amp;nbsp; 40000be&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _remoteStackTraceString&lt;br&gt;790fdb60&amp;nbsp; 40000bf&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 _remoteStackIndex&lt;br&gt;790f8a7c&amp;nbsp; 40000c0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object&amp;nbsp; 0 instance 00000000 _dynamicMethods&lt;br&gt;790fdb60&amp;nbsp; 40000c1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance -2146232060 _HResult&lt;br&gt;790f9244&amp;nbsp; 40000c2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 00000000 _source&lt;br&gt;790fcfa4&amp;nbsp; 40000c3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IntPtr&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 _xptrs&lt;br&gt;790fdb60&amp;nbsp; 40000c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance -532459699 _xcode&lt;br&gt;653c8b28&amp;nbsp; 40017e0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 44 ...qlErrorCollection&amp;nbsp; 0 instance &lt;font color="#ff0000"&gt;0b62cd90&lt;/font&gt; _errors&lt;br&gt;&lt;/div&gt; &lt;p&gt;There we have it. Now we can continue&amp;nbsp;using !dumpobject to investigate it even further if we wish.&lt;/p&gt; &lt;h2&gt;Inner exceptions&lt;/h2&gt; &lt;p&gt;If we take a look at one of the HttpUnhandledExceptions we find that it has an inner exception. It is even nice enough to let us know how to find out more about it.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !pe 10544f64 &lt;br&gt;Exception object: 10544f64&lt;br&gt;Exception type: System.Web.HttpUnhandledException&lt;br&gt;Message: &lt;none&gt;&lt;br&gt;&lt;font color="#ff0000"&gt;InnerException: System.NullReferenceException, use !PrintException 10544df8 to see more&lt;/font&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BE1D8 6614FDB2 System_Web_ni!System.Web.UI.Page.HandleError(System.Exception)+0x3e6&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BE220 6615681A System_Web_ni!System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)+0x1b3a&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF190 66154A8A System_Web_ni!System.Web.UI.Page.ProcessRequest(Boolean, Boolean)+0xd6&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF1C8 66154967 System_Web_ni!System.Web.UI.Page.ProcessRequest()+0x57&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF200 66154887 System_Web_ni!System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext)+0x13&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF208 6615481A System_Web_ni!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)+0x32&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF21C 1C741EAE App_Web__ekpvebx!ASP.sys_pages_application_application_aspx.ProcessRequest(System.Web.HttpContext)+0x1e&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF228 65FF27D4 System_Web_ni!System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+0x130&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BF25C 65FC15B5 System_Web_ni!System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)+0x41&lt;/div&gt; &lt;p&gt;This means that the System.NullReferenceException mentioned lead to the HttpUnhandledException we're currently investigating. So if we want to find the root cause we'll need to investigate the inner exception as well.&lt;/p&gt; &lt;h1&gt;Extra credit&lt;/h1&gt; &lt;p&gt;If you've looked at my "&lt;a href="http://blogs.msdn.com/johan/archive/2008/01/23/using-windbg-advanced-commands.aspx"&gt;Advanced commands&lt;/a&gt;"-post a while back you saw some examples of the .foreach command. This is a great command to use, for example if you want to see the callstack for all System.ArgumentNullExceptions. Instead of manually iterating through all the exceptions we can now dump them all at once, check their callstacks, etc.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; .foreach(myVariable {!dumpheap -type System.ArgumentNullException -short}){!pe myVariable;.echo *************}&lt;br&gt;Exception object: 03c6fbb8&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F15E3E0 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F15E43C 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 08378e24&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6EC60 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1CE6ECBC 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 084c0b30&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEEE0 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEF3C 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 08522f84&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEEE0 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEF3C 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 0c036bf8&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DC7EB60 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1DC7EBBC 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 105d7f60&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F39F360 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F39F3BC 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 106206fc&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F39F360 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1F39F3BC 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Exception object: 1077a864&lt;br&gt;Exception type: System.ArgumentNullException&lt;br&gt;Message: Value cannot be null.&lt;br&gt;InnerException: &lt;none&gt;&lt;br&gt;StackTrace (generated):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Function&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEEE0 795FC73C mscorlib_ni!System.Guid..ctor(System.String)+0x2a14bc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1E3BEF3C 1D0AB97F Foo_1cfd0000!Pages.PersonHomePage.Page_Load(System.Object, System.EventArgs)+0x77&lt;br&gt;&lt;br&gt;StackTraceString: &lt;none&gt;&lt;br&gt;HResult: 80004003&lt;br&gt;The current thread is unmanaged&lt;br&gt;*************&lt;br&gt;Unknown option: ------------------------------&lt;br&gt;*************&lt;br&gt;&lt;/div&gt; &lt;p&gt;Well this post was even longer than usual.&lt;/p&gt; &lt;p&gt;I hope you found it of value, and I'll gladly listen to any comments, feedback or wishes on future topics you might have.&lt;/p&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7353486" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/johan/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/johan/archive/tags/Debugging+School/default.aspx">Debugging School</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Implicit casting in DataRepeater not working in certain scenarios after SP1</title><link>http://blogs.msdn.com/johan/archive/2008/01/30/implicit-casting-in-datarepeater-not-working-in-certain-scenarios-after-sp1.aspx</link><pubDate>Wed, 30 Jan 2008 15:21:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7325611</guid><dc:creator>JohanS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/johan/comments/7325611.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7325611</wfw:commentRss><description>&lt;h1&gt;Problem&lt;/h1&gt; &lt;p&gt;Using the following VB-syntax in a DataRepeater will no longer work after applying .NET Framework 2.0 Service Pack 1 in a medium-trust environment.&lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;lt;asp:Repeater ID="Repeater1" runat="server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ItemTemplate&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%#Container.DataItem("data")%&amp;gt;&amp;lt;br /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ItemTemplate&amp;gt;&lt;br&gt;&amp;lt;/asp:Repeater&amp;gt;&lt;/div&gt; &lt;h1&gt;&amp;nbsp;&lt;/h1&gt; &lt;h1&gt;Resolution&lt;/h1&gt; &lt;p&gt;Use Eval-method, as recommended in all Microsoft documentation. Using explicit casting would work as well, but you'd have to re-write every page if you decide to change your data layer.&lt;/p&gt; &lt;hr&gt;  &lt;h1&gt;&amp;nbsp;&lt;/h1&gt; &lt;h1&gt;Repro&lt;/h1&gt; &lt;p&gt;Create an ASP.NET page with a repeater using a simple OleDb database as it's DataSource.&lt;/p&gt; &lt;p&gt;If you run this application in full trust, you should encounter no problems.&lt;/p&gt; &lt;p&gt;Now, set the trust level to medium. (You'll have to modify the settings and give it access to OleDbConnections.) When you run it you'll get a Security Exception:&lt;/p&gt; &lt;div class="SampleFrame"&gt;&lt;strong&gt;Security Exception&lt;/strong&gt; &lt;br&gt;&lt;strong&gt;Description&lt;/strong&gt;: The application attempted to perform an operation not allowed by the security policy.&amp;nbsp; To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. &lt;br&gt;&lt;br&gt;&lt;strong&gt;Exception Details&lt;/strong&gt;: System.Security.SecurityException: Request failed.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Source Error&lt;/strong&gt;: &lt;br&gt;&lt;br&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&amp;nbsp; &lt;br&gt;&lt;br&gt;&lt;strong&gt;Stack Trace&lt;/strong&gt;: &lt;br&gt;&lt;br&gt;[SecurityException: Request failed.]&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +281&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet&amp;amp; alteredDemandset, RuntimeMethodHandle rmh) +67&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +145&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +43&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +41&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +139&lt;br&gt;&amp;nbsp;&amp;nbsp; System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +51&lt;br&gt;&lt;/div&gt; &lt;h1&gt;&amp;nbsp;&lt;/h1&gt; &lt;h1&gt;Cause and resolution&lt;/h1&gt; &lt;p&gt;Visual Basic has always been strong on implicit casting. For example, this code is completely valid:&lt;/p&gt; &lt;div class="SampleCode"&gt;Dim myString As String = 10 &lt;/div&gt; &lt;p&gt;So, in the sample at the top, Container.DataItem is merely an Object. VB then casts this to a System.Data.Common.DbDataRecord object and we're able to retrieve the "data"-property. This is no longer working after Service Pack 1.&lt;/p&gt; &lt;p&gt;C, in all its variations wouldn't be caught dead accepting a syntax like String = Integer, so the code at the top would &lt;em&gt;never&lt;/em&gt; work. Instead you'd have to explicitly cast the object to the appropriate type:&lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;lt;asp:Repeater ID="Repeater1" runat="server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ItemTemplate&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%#((System.Data.Common.DbDataRecord)Container.DataItem)["data"]%&amp;gt;&amp;lt;br /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ItemTemplate&amp;gt;&lt;br&gt;&amp;lt;/asp:Repeater&amp;gt;&lt;/div&gt; &lt;p&gt;If you change the VB code so that it uses the VB equivalent: CType you will resolve the problem.&lt;/p&gt; &lt;h2&gt;This has never been the recommended approach&lt;/h2&gt; &lt;p&gt;So, is the resolution to use explicit casting? Well, not really. If you look at the C# example above you might notice a potential problem. If we change our data layer we would have to go through every single page and change the explicit casting. This is one of the reasons why we've always recommended using the Databinder.Eval method for VB and C# alike, so if you've followed the design guidelines your code should look like this:&lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;lt;asp:Repeater ID="Repeater1" runat="server"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ItemTemplate&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%#DataBinder.Eval(Container.DataItem, "data")%&amp;gt;&amp;lt;br /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ItemTemplate&amp;gt;&lt;br&gt;&amp;lt;/asp:Repeater&amp;gt;&lt;/div&gt; &lt;p&gt;Actually, as of Framework 2.0&amp;nbsp;it's enough to write &lt;span class="InlineCode"&gt;Eval("data")&lt;/span&gt;.&lt;/p&gt; &lt;p&gt;So,&amp;nbsp;if you review the documentation on msdn for &lt;a href="http://msdn2.microsoft.com/en-us/library/c012haty(VS.71).aspx"&gt;Framework 1.1&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/c012haty(VS.80).aspx"&gt;Framework 2.0&lt;/a&gt;, &lt;a href="http://support.microsoft.com/?kbid=307860"&gt;knowledge base&lt;/a&gt; articles, etc. you'll see that we consistently recommend using the Eval method.&lt;/p&gt; &lt;p&gt;/ Johan&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7325611" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Using WinDbg - Advanced commands</title><link>http://blogs.msdn.com/johan/archive/2008/01/23/using-windbg-advanced-commands.aspx</link><pubDate>Wed, 23 Jan 2008 17:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7209127</guid><dc:creator>JohanS</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/johan/comments/7209127.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7209127</wfw:commentRss><description>&lt;p&gt;Did you know you can build your own advanced commands using for each, if, etc? The complete list of control tokens are:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;.if  &lt;li&gt;.else  &lt;li&gt;.elseif  &lt;li&gt;.foreach  &lt;li&gt;.for  &lt;li&gt;.while  &lt;li&gt;.do  &lt;li&gt;.break  &lt;li&gt;.continue  &lt;li&gt;.catch  &lt;li&gt;.leave  &lt;li&gt;.printf  &lt;li&gt;.block&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Using these command tokes you can send quite advanced instructions to the debugger that not only will make your job a lot easier, but also impress your manager immensely. :)&lt;/p&gt; &lt;h1&gt;.foreach&lt;/h1&gt; &lt;p&gt;Let's begin with an easy example. Imagine you want to investigate all strings on the heap that are 6500 bytes or more. To list them you'd simply type &lt;span class="InlineCode"&gt;!dumpheap -type System.String -min 6500&lt;/span&gt;. This will give you the following information:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !dumpheap -type System.String -min 6500&lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;790da154 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9280&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;0264c4d0 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp; 32788&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 2 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 2&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;0b62e790 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp; 11284&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 1 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 3&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;0e6839d0 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp; 32788&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;0e717904 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp; 32788&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;0fb2a320 790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6828&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 3 objects&lt;br&gt;------------------------------&lt;br&gt;total 6 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;790f9244&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 125756 System.String&lt;br&gt;Total 6 objects&lt;/div&gt; &lt;p&gt;So far, so good. The problem is that in order to investigate each string you'd have to run !dumpobject (!do) on every address. This might be acceptable now that we're only dealing with 6 strings, but what if it were 25, or 100? I don't know if you're aware of this, but if you pass the -short argument to !dumpheap it will give you the minimum information (just the addresses of the objects in question):&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !dumpheap -type System.String -min 6500 &lt;font color="#ff0000"&gt;-short&lt;/font&gt;&lt;br&gt;790da154 &lt;br&gt;0264c4d0 &lt;br&gt;0b62e790 &lt;br&gt;0e6839d0 &lt;br&gt;0e717904 &lt;br&gt;0fb2a320 &lt;br&gt;------------------------------&lt;/div&gt; &lt;p&gt;Now, let's use this information in a .foreach-clause:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; .foreach(myVariable {!dumpheap -type System.String -min 6500 -short}){!do myVariable;.echo *************}&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 9280(0x2440) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String: &lt;br&gt;&lt;font color="#ff0000"&gt;WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWGRkAiEPDxYCHwEFZFhYWFhYWFhYWFhYWFhYWFhYWFhYWF&lt;br&gt;hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY&lt;br&gt;WFhYWFhYWFhYWFhkZAInDw8WCh8CBQFFHwMFCjIyLzExLzIwMDcfBAUBVh8FBQFFHwYFASpkZAIpD2QWBGYPZBYEAg&lt;br&gt;ETC...&lt;/font&gt;&lt;br&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4632 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4631 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 32786(0x8012) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String: &lt;br&gt;&lt;font color="#ff0000"&gt;g8PFgIfAQUHYWFhYWFhYWRkAgMPDxYCHwEFCWFhYWFhYWFhYWRkAgQPDxYCHwEFCjI4LzEyLzIwMDdkZAIvD2QWAmY&lt;br&gt;PZBYCZg9kFgICAw8PFgIfAQUFWFhYWFhkZAIxDw8WAh8JZ2QWBGYPZBYEAgEPZBYCZg9kFgQCAQ8WAh8IBQMxcHgWA&lt;br&gt;gIBDw8WAh8JaGRkAgMPZBYEAgEPDxYCHwEFCkFkZCBSZWNvcmRkZAIDDw8WAh8ABRZ+L0ltYWdlcy9UaXRsZS9OZXc&lt;br&gt;ETC...&lt;/font&gt;&lt;br&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 16385 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 10960 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 11282(0x2c12) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String: &lt;br&gt;&lt;font color="#ff0000"&gt;WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWGRkAiEPDxYCHwEFZFhYWFhYWFhYWFhYWFhYWFhYWFhYWFa&lt;br&gt;YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF&lt;br&gt;hYWFhYWFhYWFhYWFhYWFhkZAInDw8WCh8CBQFFHwMFCjIyLzExLzIwMDcfBAUBVh8FBQFFHwYFASpkZAIpD2QWBGYPZ&lt;br&gt;ETC...&lt;br&gt;&lt;/font&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5633 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3092 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5b m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 32786(0x8012) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String:&lt;br&gt;&lt;font color="#ff0000"&gt;SRU5UIFBBR0U6IDMgb2YgMTVkZAILD2QWAmYPZBYcAgcPDxYCHwEFZFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF&lt;br&gt;hYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYW&lt;br&gt;FhYWFhkZAINDw8WCh4BRQUBRR4CVFQFCjIyLzExLzIwMDceAlRWBQFWHgJURQUBRR4CVFIFASpkZAITDw8WCh8CBQFF&lt;br&gt;ETC...&lt;br&gt;&lt;/font&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 16385 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 10960 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 32786(0x8012) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String:&lt;br&gt;&lt;font color="#ff0000"&gt;0b25Ib21lBR9BcHBsaWNhdGlvbk5hdmlnYXRpb246aWJ0TG9nb3V0BTdfY3RsMDpQZXJzb25BcHBsaWNhdGlvbkRlZ3J&lt;br&gt;lZUxpc3Q6U3lzdGVtVGl0bGU6RWRpdEltYWdlBT5fY3RsMDpQZXJzb25BcHBsaWNhdGlvbkRlZ3JlZURpcGxvbWFMaXN&lt;br&gt;0OlN5c3RlbVRpdGxlOkVkaXRJbWFnZQVDX2N0bDA6UGVyc29uQXBwbGljYXRpb25PdGhlclF1YWxpZmljYXRpb25MaXN&lt;br&gt;ETC...&lt;/font&gt;&lt;br&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 16385 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp; 10960 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Name: System.String&lt;br&gt;MethodTable: 790f9244&lt;br&gt;EEClass: 790f91a4&lt;br&gt;Size: 6826(0x1aaa) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)&lt;br&gt;String: &lt;br&gt;&lt;font color="#ff0000"&gt;/wEPDwULLTEyMTQ5MDkyMjgPZBYCAgEPZBYGAgcPZBYEAgEPDxYCHghJbWFnZVVybAUrfi9pbWFnZXMvbmF2ZAILD2QW&lt;br&gt;aWdhdGlvbi9wYWdlcy9QYWdlMlByb2dyZXNzLmdpZmRkAgIPDxYCHgRUZXh0BRVDVVJSRU5UIFBBR0U6IDMgb2YgMTVk&lt;br&gt;ZAILD2QWAmYPZBYcAgcPDxYCHwEFZFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhY&lt;br&gt;ETC...&lt;br&gt;&lt;/font&gt;&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;790fdb60&amp;nbsp; 4000096&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3405 m_arrayLength&lt;br&gt;790fdb60&amp;nbsp; 4000097&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3404 m_stringLength&lt;br&gt;790fad38&amp;nbsp; 4000098&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char&amp;nbsp; 1 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2f m_firstChar&lt;br&gt;790f9244&amp;nbsp; 4000099&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static Empty&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:790d57b4 000fb4c0:790d57b4 000ca848:790d57b4 1d8334d8:790d57b4 &amp;lt;&amp;lt;&lt;br&gt;79122994&amp;nbsp; 400009a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Char[]&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static WhitespaceChars&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 000d5eb8:026203f0 000fb4c0:02624504 000ca848:026745f0 1d8334d8:026dcef4 &amp;lt;&amp;lt;&lt;br&gt;*************&lt;br&gt;Unknown option: ------------------------------&lt;br&gt;*************&lt;br&gt;&lt;/div&gt; &lt;p&gt;Let's analyze the exact syntax. Here's the command&lt;/p&gt;&lt;span class="InlineCode"&gt;.foreach(myVariable {!dumpheap -type System.String -min 6500 -short}){!do myVariable;.echo *************}&lt;/span&gt;  &lt;p&gt;"myVariable"&amp;nbsp;is, as the&amp;nbsp;name implies, the name of the variable that I wish to&amp;nbsp;use&amp;nbsp;for the data generated by the first set of commands. The second set of commands is&amp;nbsp;what I wish to execute for each token. First I run !do on the variable, and then I use the .echo-command to print a separator in order to make it a bit easier on the eyes.&lt;/p&gt; &lt;p&gt;There are additional parameters you can use. For example you can choose to skip every &lt;em&gt;n&lt;/em&gt; number of variables, or specify a text file to be parsed&amp;nbsp;and used as tokens instead. Take a look at the windbg documentation if you're interested.&lt;/p&gt; &lt;h1&gt;.shell&lt;/h1&gt; &lt;p&gt;I first saw this being used by my colleague &lt;a href="http://blogs.msdn.com/dougste/"&gt;Doug Stewart&lt;/a&gt;, who is a genius with these things.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; .shell -i - -ci "!iisinfo.clientconns" FIND /c "Request active"&lt;br&gt;40&lt;br&gt;.shell: Process exited&lt;/div&gt; &lt;p&gt;What it does is, it runs !iisinfo.clientonns and uses the MS-DOS FIND-command to count the number of times the string "Request active" appears. Off course you could use it to search for certain strings from any type of output, like "&lt;span class="InlineCode"&gt;.shell -i - -ci "!do 0b62e790" FIND /c /i "&amp;lt;table"&lt;/span&gt;" or whatever suits your needs.  &lt;p&gt;Let's take a quick look at the syntax.  &lt;p&gt;When it comes to ".shell" the -i option is mandatory. It specifies the file we want to use for input. In this scenario we don't want to use a file, so we add another hyphen, resulting in the following syntax: "&lt;span class="InlineCode"&gt;.shell &lt;font color="#ff0000"&gt;-i -&lt;/font&gt;&lt;/span&gt;"  &lt;p&gt;We then add the -ci&amp;nbsp; option, which states that we should treat the following commands as an input file instead. "&lt;span class="InlineCode"&gt;.shell -i - &lt;font color="#ff0000"&gt;-ci "!iisinfo.clientconns"&lt;/font&gt;&lt;/span&gt;"  &lt;p&gt;Finally we state what shell command we wish to run using this input. "&lt;span class="InlineCode"&gt;.shell -i - -ci "!iisinfo.clientconns" &lt;font color="#ff0000"&gt;FIND /c "Request active"&lt;/font&gt;&lt;/span&gt;".  &lt;p&gt;&lt;/p&gt; &lt;p&gt;Naturally we can use any complicated command we wish in the statement, so instead of !iisinfo.clientconns we could run&amp;nbsp;one of our .foreach-loops instead.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7209127" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/johan/archive/tags/Debugging+School/default.aspx">Debugging School</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Exceptions</title><link>http://blogs.msdn.com/johan/archive/2008/01/18/exceptions.aspx</link><pubDate>Fri, 18 Jan 2008 18:50:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7150105</guid><dc:creator>JohanS</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/johan/comments/7150105.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=7150105</wfw:commentRss><description>&lt;h1&gt;Introduction&lt;/h1&gt; &lt;p&gt;This was originally intended to be a post on identifying and troubleshooting Exceptions using windbg. As I started writing I thought I should write a little something about exceptions in general, just to begin the post. That little something grew to be quite big and all of a sudden it was by all means worthy of a post of its own. &lt;/p&gt; &lt;p&gt;There are two scenarios that are exceptionally (no pun intended) common in my line of work:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Clients are reporting 2nd chance exceptions displayed on screen with the classic "Server Error"- page.  &lt;li&gt;Performance is generally bad, and when we investigate it turns out that there are tons of exceptions being thrown every second.&lt;/li&gt;&lt;/ol&gt; &lt;h2&gt;What exactly is an exception?&lt;/h2&gt; &lt;p&gt;When it comes to the .NET Framework an exception is a managed object that inherits from the Exception Class. It is usually&amp;nbsp;created when something's gone wrong either in the application or the runtime. The exception contains detailed information about the error that created it such as a friendly error message, the stack trace leading to this exception being created, possible inner exceptions (exceptions that caused the exception) and more. In other words they contain a lot more information than a function simply returning a status code other than 0 if something went wrong. This makes it a lot easier for us to troubleshoot the application.&lt;/p&gt; &lt;p&gt;The downside is that this is resource-consuming. All the information available needs to be gathered and so throwing an exception is a lot more costly than returning an error code.&lt;/p&gt; &lt;h2&gt;Exceptions must be handled&lt;/h2&gt; &lt;p&gt;When an exception is thrown it must be handled one way or another or the application/web request will crash/fail. This is done by setting up a try/catch block. &lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;nbsp;&amp;nbsp; try {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; conn.Close();&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp; catch(Exception ex) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Something went wrong.&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;/div&gt; &lt;p&gt;If anything goes wrong within the try block, the catch block can now deal with it and act appropriately. It is still up to you to code a suitable reaction to the exception, but the interesting thing is that you &lt;strong&gt;need&lt;/strong&gt; to deal with the problem. If the exception is unattended it will cause the application to crash (winforms) or return a "Server Error"-page (IIS).&lt;/p&gt; &lt;p&gt;This is really good, because this way you will know, one way or the other, that something has gone wrong. Even if you forget to add a try/catch block the exception will still be thrown. This will possibly cause the application to crash, but that's a much better option than continuing execution as if nothing happened.&lt;/p&gt; &lt;h2&gt;Exceptions should be avoided&lt;/h2&gt; &lt;p&gt;This is really important. To throw an exception is costly. Chris Brumme has written an &lt;a href="http://blogs.msdn.com/cbrumme/archive/2003/10/01/51524.aspx"&gt;excellent post&lt;/a&gt; on this subject and in it he writes about some&amp;nbsp;of the things that the runtime does&amp;nbsp;when throwing an exception. Such as:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Grab a stack trace by interpreting metadata emitted by the compiler to guide our stack unwind.  &lt;li&gt;Run through a chain of handlers up the stack, calling each handler twice.  &lt;li&gt;Compensate for mismatches between SEH, C++ and managed exceptions.  &lt;li&gt;Allocate a managed Exception instance and run its constructor. Most likely, this involves looking up resources for the various error messages.  &lt;li&gt;Probably take a trip through the OS kernel. Often take a hardware exception.  &lt;li&gt;Notify any attached debuggers, profilers, vectored exception handlers and other interested parties.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Exceptions are there to tell you that something's gone wrong, but since they're quite costly to throw it would be much better if you anticipated them and tried to minimize them.&lt;/p&gt; &lt;p&gt;Why use the following code:&lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void calculateAvg(Int32 X, Int32 Y)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label1.Text = (X / Y).ToString();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception e)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label1.Text = "Division by Zero";&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt; &lt;p&gt;when you can just as well use this:&lt;/p&gt; &lt;div class="SampleCode"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void calculateAvg(Int32 X, Int32 Y)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Y != 0)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label1.Text = (X / Y).ToString();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Label1.Text = "Division by Zero";&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;/div&gt; &lt;p&gt;As you can see, the first piece of code will throw an exception if Y happens to be zero. And all to no use. Take a look again at all the things we go through when throwing an exception and consider if that is really necessary when all you needed to do was to verify that Y != 0.&lt;/p&gt; &lt;h2&gt;How many exceptions is your application throwing&amp;nbsp;per second?&lt;/h2&gt; &lt;p&gt;In a perfect world you should be able to answer this without hesitation. Anyway, if you honestly have no idea then I suggest you start Performance Monitor, add a counter for &lt;em&gt;.NET CLR Exceptions/# of Exceps Thrown &lt;/em&gt;and run a stress test.&lt;/p&gt; &lt;p&gt;&lt;img src="http://blogs.msdn.com/photos/johan/images/7055183/original.aspx"&gt; &lt;/p&gt; &lt;p&gt;I've come across applications that throw over 150.000 exceptions in less than an hour.&lt;/p&gt; &lt;p&gt;There may also be times when this is actually expected and acceptable. For example, the Response.Redirect command results in a System.Threading.ThreadAbortException. If your application relies heavily on Response.Redirect for some reason, then you needn't worry. If, however, you're not aware of what is causing these exceptions I'd urge you to look into it.&lt;/p&gt; &lt;p&gt;None of us would want to let our systems run with constant red or yellow warnings in the event logs. The least we'd do is check up on them and see what caused them.&lt;/p&gt; &lt;p&gt;Well, having written this little introduction I guess I should now get going on the "&lt;em&gt;real&lt;/em&gt;" post. The one&amp;nbsp;about how to find and troubleshoot those exceptions using Windbg...&lt;/p&gt; &lt;p&gt;Later!&amp;nbsp;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7150105" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/johan/archive/tags/Exceptions/default.aspx">Exceptions</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Aspnet_state.exe crashing on Xp</title><link>http://blogs.msdn.com/johan/archive/2007/12/21/aspnet-state-exe-crashing-on-xp.aspx</link><pubDate>Fri, 21 Dec 2007 18:35:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6828257</guid><dc:creator>JohanS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/johan/comments/6828257.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=6828257</wfw:commentRss><description>&lt;p&gt;I ran across an interesting situation with a customer today.&lt;/p&gt; &lt;p&gt;He had a workstation running Windows Xp Professional. He'd&amp;nbsp;previously been running Framework 1.1 and had been using the ASP.NET State Service. He had now upgraded to framework 2.0. and upon shutdown he now received the following error:&lt;/p&gt; &lt;p&gt;aspnet_state.exe. Application Error. The instruction at "&lt;a&gt;0x6a2a2fec&lt;/a&gt;" referenced memory at "0x0000000c". The memory could not be "read".&lt;/p&gt; &lt;p&gt;To make a long story short it turned out this was due to an access violation upon shutdown. We did the following and resolved the situation:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Start Regedit.&lt;/li&gt; &lt;li&gt;Navigate to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ASP.NET_2.0.50727 key.&lt;/li&gt; &lt;li&gt;Right-click "Names" and select Permissions on the context menu.&lt;/li&gt; &lt;li&gt;Click Add and enter NETWORK SERVICE, click "Check Names" and click Ok.&lt;/li&gt; &lt;li&gt;With NETWORK SERVICE highlighted in the "Groups or User Names" list click "Advanced".&lt;/li&gt; &lt;li&gt;On the "Advanced Security Settings for Names" dialogue highlight NETWORK SERVICE and click "Edit".&lt;/li&gt; &lt;li&gt;In the "Permission entry for Names" dialogue check the "Name" box is showing "NETWORK SERVICE" and put check marks against "Query Value", "Set Value", "Create Subkey", "Enumerate Subkeys", "Notify" and "Read Control".&lt;/li&gt; &lt;li&gt;Click Ok on all the dialogues and close Regedit.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;As I assisted him it turned out my customer had searched the web for a solution and had found quite a few people experiencing the same problem. I guess most of you are working with Windows 2003 / Vista, so this information might be a bit obsolete. But I thought I should share the knowledge anyway.&lt;/p&gt; &lt;p&gt;Happy Holidays! / Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6828257" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/SessionState/default.aspx">SessionState</category><category domain="http://blogs.msdn.com/johan/archive/tags/Bugs/default.aspx">Bugs</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Lot's of objects on the Large Object Heap on a 64-bit server</title><link>http://blogs.msdn.com/johan/archive/2007/12/14/lot-s-of-objects-on-the-large-object-heap-on-a-64-bit-server.aspx</link><pubDate>Fri, 14 Dec 2007 17:31:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6770356</guid><dc:creator>JohanS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/johan/comments/6770356.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=6770356</wfw:commentRss><description>&lt;p&gt;My colleague &lt;a href="http://blogs.msdn.com/tess"&gt;Tess&lt;/a&gt; showed me a dump today which I thought was really interesting. The scenario was as follows:&lt;/p&gt; &lt;p&gt;- We have a web application that's been running successfully on a 32-bit server for quite some time. We've now moved to a 64-bit server. The code remains unchanged but we're seeing a lot more objects on the Large Object Heap (LOH). How's that possible?&lt;/p&gt; &lt;p&gt;Well looking closer at the LOH revealed a lot of Object Arrays. These arrays were around the 150 KB-range. An Object Array is nothing but a collection of addresses, each being one DWORD long (32-bit). When we&amp;nbsp;ran the application in a&amp;nbsp;64-bit environment the addresses were now &lt;em&gt;two&lt;/em&gt; DWORDS long.&amp;nbsp;Since the addresses had doubled in size the Object Arrays had &lt;em&gt;also&lt;/em&gt; doubled in size. In the 32-bit environment they were around 75 KB, but now they were 150 KB.&amp;nbsp;As I've &lt;a href="http://blogs.msdn.com/johan/archive/2007/04/20/memory-management-in-the-net-framework.aspx"&gt;mentioned before&lt;/a&gt;, the limit for when an object&amp;nbsp;goes&amp;nbsp;on the Large Object Heap is 85 KB, so all those arrays now ended up on the LOH.&lt;/p&gt; &lt;p&gt;Since the LOH also isn't compacted this lead to a lot of fragmentation as well. All in all the memory usage of the exact same application saw a significant increase when being executed in the 64-bit environment.&lt;/p&gt; &lt;p&gt;Tess has actually blogged about this in the past. I definitively recommend taking a look at &lt;a href="http://blogs.msdn.com/tess/archive/2007/08/09/asp-net-memory-issue-high-memory-usage-in-a-64bit-w3wp-exe-process.aspx"&gt;that article&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6770356" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Getting started with windbg - part II</title><link>http://blogs.msdn.com/johan/archive/2007/11/26/getting-started-with-windbg-part-ii.aspx</link><pubDate>Mon, 26 Nov 2007 16:49:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6531187</guid><dc:creator>JohanS</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/johan/comments/6531187.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=6531187</wfw:commentRss><description>&lt;p&gt;This is a continuation of my previous post with the imaginative name &lt;a href="http://blogs.msdn.com/johan/archive/2007/11/13/getting-started-with-windbg-part-i.aspx"&gt;Getting started with windbg - part I&lt;/a&gt;. I'll be assuming that you've read it, so if you haven't I suggest you check it out first. We're still working with the same sample dump, so I'll pretty much pick up right where we left off.&lt;/p&gt; &lt;h1&gt;More useful commands&lt;/h1&gt; &lt;p&gt;Last time we used some nice commands from the sos-extension to look at the running callstacks, the requests, the CPU load of the threads, etc. We also dug deeper into the callstack to see what distinguished name we used for a SearchRequest. We'll keep using these commands, but also learn a few new ones.&lt;/p&gt; &lt;h2&gt;!dumpstackobjects (!dso)&lt;/h2&gt; &lt;p&gt;Now, imagine that we're looking at a specific thread and would like to see all managed objects referenced to by the current stack. Is there a way for us to do this? - There most certainly is. It's called dumpstackobjects, or dso for short. If we run it on the current thread we'll see a listing of objects that are referenced by the callstack. The whole output would look something like this (trimmed down to size):&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dso&lt;br&gt;OS Thread Id: 0x1e8c (50)&lt;br&gt;ESP/REG&amp;nbsp; Object&amp;nbsp;&amp;nbsp; Name&lt;br&gt;17a9e534 0741f860 System.RuntimeType&lt;br&gt;17a9e6b8 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e6bc 27246f20 System.DirectoryServices.Protocols.SEC_WINNT_AUTH_IDENTITY_EX&lt;br&gt;17a9e740 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e744 27246f20 System.DirectoryServices.Protocols.SEC_WINNT_AUTH_IDENTITY_EX&lt;br&gt;17a9e764 27246f20 System.DirectoryServices.Protocols.SEC_WINNT_AUTH_IDENTITY_EX&lt;br&gt;17a9e768 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e780 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e784 27246e38 System.DirectoryServices.Protocols.SearchRequest&lt;br&gt;17a9e794 271fdf14 System.DirectoryServices.Protocols.LdapDirectoryIdentifier&lt;br&gt;17a9e7a8 27246ef8 System.Collections.ArrayList&lt;br&gt;17a9e7bc 27246ef8 System.Collections.ArrayList&lt;br&gt;17a9e7c8 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e8a4 27246e38 System.DirectoryServices.Protocols.SearchRequest&lt;br&gt;17a9e8d0 27246ed8 System.Object[]&amp;nbsp;&amp;nbsp;&amp;nbsp; (System.Object[])&lt;br&gt;17a9e8e0 073ff6b8 System.String&amp;nbsp;&amp;nbsp;&amp;nbsp; cn&lt;br&gt;17a9e8e4 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e8f4 27246d00 System.String&amp;nbsp;&amp;nbsp;&amp;nbsp; CN=Dummy,CN=Accounts,CN=useradm,DC=Dummy,DC=net&lt;br&gt;17a9e8f8 271fdfe0 System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;17a9e8fc 27246e38 System.DirectoryServices.Protocols.SearchRequest&lt;br&gt;17a9e910 03380310 System.String&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;17a9e914 27246e24 System.Object[]&amp;nbsp;&amp;nbsp;&amp;nbsp; (System.String[])&lt;br&gt;17a9e918 272399a8 System.String&amp;nbsp;&amp;nbsp;&amp;nbsp; CN=OID-Dummy-ABC123,CN=Dummy,CN=Accounts,CN=useradm,DC=Dummy,DC=net&lt;br&gt;17a9e91c 27246ddc System.String&amp;nbsp;&amp;nbsp;&amp;nbsp; (CN=OID-Dummy-ABC123)&lt;br&gt;...etc...&lt;/div&gt; &lt;p&gt;This is extremely useful when we want to see all the objects referenced by this thread alone. If you want to analyze one of the objects, simply copy the the address from the Object-column and use !dumpobject:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !do 271fdfe0 &lt;br&gt;Name: System.DirectoryServices.Protocols.LdapConnection&lt;br&gt;MethodTable: 14a2040c&lt;br&gt;EEClass: 149daf08&lt;br&gt;Size: 56(0x38) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_MSIL\System.DirectoryServices.Protocols\2.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.Protocols.dll)&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;14a2078c&amp;nbsp; 40000c3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4 ...NetworkCredential&amp;nbsp; 0 instance 00000000 directoryCredential&lt;br&gt;14a2144c&amp;nbsp; 40000c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 ...ificateCollection&amp;nbsp; 0 instance 271fe018 certificatesCollection&lt;br&gt;1202af88&amp;nbsp; 40000c5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.TimeSpan&amp;nbsp; 1 instance 271fdff0 connectionTimeOut&lt;br&gt;1466fe50&amp;nbsp; 40000c6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c ...rectoryIdentifier&amp;nbsp; 0 instance 271fdf14 directoryIdentifier&lt;br&gt;14a2034c&amp;nbsp; 4000236&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 connectionAuthType&lt;br&gt;14a223a4&amp;nbsp; 4000237&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18 ...dapSessionOptions&amp;nbsp; 0 instance 271fe2d8 options&lt;br&gt;0fb896d8&amp;nbsp; 4000238&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IntPtr&amp;nbsp; 0 instance 564180944 ldapHandle&lt;br&gt;120261c8&amp;nbsp; 4000239&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 disposed&lt;br&gt;120261c8&amp;nbsp; 400023a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 bounded&lt;br&gt;120261c8&amp;nbsp; 400023b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 needRebind&lt;br&gt;14a22084&amp;nbsp; 400023e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c ...pResponseCallback&amp;nbsp; 0 instance 271fe03c fd&lt;br&gt;120261c8&amp;nbsp; 4000243&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 setFQDNDone&lt;br&gt;120261c8&amp;nbsp; 4000244&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 automaticBind&lt;br&gt;120261c8&amp;nbsp; 4000245&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 needDispose&lt;br&gt;120261c8&amp;nbsp; 4000246&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 connected&lt;br&gt;14a2267c&amp;nbsp; 4000247&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 ...s.QUERYCLIENTCERT&amp;nbsp; 0 instance 271fe394 clientCertificateRoutine&lt;br&gt;0fd314bc&amp;nbsp; 400023c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 ...ections.Hashtable&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static handleTable&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe504 &amp;lt;&amp;lt;&lt;br&gt;02c36ca0&amp;nbsp; 400023d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static objectLock&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe53c &amp;lt;&amp;lt;&lt;br&gt;0fd314bc&amp;nbsp; 400023f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28 ...ections.Hashtable&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static asyncResultTable&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe610 &amp;lt;&amp;lt;&lt;br&gt;14a21864&amp;nbsp; 4000240&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2c ...lResultsProcessor&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static partialResultsProcessor&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe678 &amp;lt;&amp;lt;&lt;br&gt;12305e94&amp;nbsp; 4000241&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30 ....ManualResetEvent&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static waitHandle&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe64c &amp;lt;&amp;lt;&lt;br&gt;14a21954&amp;nbsp; 4000242&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34 ...lResultsRetriever&amp;nbsp; 0&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static retriever&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:073fe6a8 &amp;lt;&amp;lt;&lt;/div&gt; &lt;h2&gt;&amp;nbsp;&lt;/h2&gt; &lt;h2&gt;!dumparray (!da)&lt;/h2&gt; &lt;p&gt;As you might have noticed we have a couple of&amp;nbsp;object arrays on the stack.&amp;nbsp;Look for the System.Object[]-type in the listing above and you'll find them. If you execute !dumpobject on an array you'll only get information about the array itself, not it's contents. To get information about what's in the array we need to use the !dumparray-command, or !da for short.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !do 27239b98 &lt;br&gt;Name: System.Object[]&lt;br&gt;MethodTable: 02c3896c&lt;br&gt;EEClass: 02c388ec&lt;br&gt;Size: 24(0x18) bytes&lt;br&gt;Array: Rank 1, Number of elements 2, Type CLASS&lt;br&gt;Element Type: System.String&lt;br&gt;Fields:&lt;br&gt;None&lt;br&gt;&lt;br&gt;0:050&amp;gt; !da 27239b98 &lt;br&gt;Name: System.String[]&lt;br&gt;MethodTable: 02c3896c&lt;br&gt;EEClass: 02c388ec&lt;br&gt;Size: 24(0x18) bytes&lt;br&gt;Array: Rank 1, Number of elements 2, Type CLASS&lt;br&gt;Element Methodtable: 02c39310&lt;br&gt;[0] 272399a8&lt;br&gt;[1] 27239a44&lt;/div&gt; &lt;p&gt;As you can see the !dumparray-command gives us a bit more information about the object. We can see that it contains System.String data and we get the addresses of the two items in the array.&amp;nbsp;Since they're System.String-objects we can simply&amp;nbsp;use !dumpobject to view their contents.&lt;/p&gt; &lt;h2&gt;!objsize&lt;/h2&gt; &lt;p&gt;If you look at the listing above you'll see that the size of the object is listed as 24 bytes. To paraphrase Obi Wan Kenobi: "This is true, from a certain point of view." The 24 bytes are the size of the System.Object[]-object itself. Not it's contents. As you can see when we execute !dumparray, the array only contains two references to two strings. These strings are individual objects and could be 32 MB for all we know, so the 24 bytes are not the &lt;em&gt;total &lt;/em&gt;size of the array, but it would still be correct to claim that the System.Object[] is only 24 bytes large.&lt;/p&gt; &lt;p&gt;To get the &lt;em&gt;total&lt;/em&gt; size of the object we use the !objsize command:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !objsize 27239b98 &lt;br&gt;sizeof(27239b98) =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 348 (&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x15c) bytes (System.Object[])&lt;/div&gt; &lt;p&gt;!objsize will iterate through all the child objects referenced by the&amp;nbsp;object, as well as all the grandchildren and so on. Apparently the total size of the array and it's child objects is 348 bytes.&lt;/p&gt; &lt;p&gt;If there are a lot of child objects it may take some time for !objsize to calculate the total size of the object. You should also be aware that !objsize may not always be as smart as you'd like. If, for example, you have a custom button control that references it's parent aspx-page you'd get the total size of the aspx-page and all it's child controls. In other words: If !objsize claims that the object in question is ridiculously large you might want to manually check what the object references using !dumpobject.&lt;/p&gt; &lt;h2&gt;!dumpheap&lt;/h2&gt; &lt;p&gt;This is another command that I use frequently. It is, however a command that you will want to use with at least one argument. Dumpheap with no arguments will dump &lt;em&gt;all &lt;/em&gt;objects on the heap, so I usually begin by using the -stat argument, which in itself will write a lot of info on the screen, but it will at least be summarized. Here' you'll find the trimmed down output of !dumpheap -stat:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dumpheap -stat&lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;total 2754508 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;total 2761329 objects&lt;br&gt;------------------------------&lt;br&gt;total 5515837 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;16e0a6d8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Collections.Generic.ObjectEqualityComparer`1[[System.Data.ProviderBase.DbConnectionInternal, System.Data]]&lt;br&gt;16d9cd9c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Xml.Serialization.Configuration.DateTimeSerializationSection+DateTimeSerializationMode&lt;br&gt;16d9bf30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Diagnostics.OrdinalCaseInsensitiveComparer&lt;br&gt;16d9112c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Xml.Serialization.NameTable&lt;br&gt;16d7f664&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Xml.Serialization.TempAssemblyCache&lt;br&gt;163ea85c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Data.Res&lt;br&gt;1501e4c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Collections.Generic.ObjectEqualityComparer`1[[System.Web.UI.Control, System.Web]]&lt;br&gt;14efb138&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.TimeoutValidator&lt;br&gt;14ef9964&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.Cache.HttpRequestCacheLevel&lt;br&gt;14ef77a8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 Microsoft.Win32.WinInetCache&lt;br&gt;14ef68e4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.WebRequest+WebProxyWrapper&lt;br&gt;14ef658c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.Configuration.ProxyElement+BypassOnLocalValues&lt;br&gt;14ef63d8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.Configuration.ProxyElement+AutoDetectValues&lt;br&gt;14ef5b68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.CaseInsensitiveAscii&lt;br&gt;14ef5610&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.HeaderInfoTable&lt;br&gt;14ef4718&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.HttpRequestCreator&lt;br&gt;14db6710&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Web.Configuration.MachineKeyValidationConverter&lt;br&gt;14db3140&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Collections.Generic.ObjectEqualityComparer`1[[System.Runtime.Serialization.MemberHolder, mscorlib]]&lt;br&gt;14b3f4d8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Web.UI.SupportsEventValidationAttribute&lt;br&gt;...etc...&lt;br&gt;14a276a8&amp;nbsp;&amp;nbsp;&amp;nbsp; 19578&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 704808 System.DirectoryServices.Interop.AdsValueHelper&lt;br&gt;14a2ea24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9196&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 735680 System.Web.UI.WebControls.Label&lt;br&gt;14a2e51c&amp;nbsp;&amp;nbsp;&amp;nbsp; 16862&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 741928 System.Web.UI.WebControls.Style&lt;br&gt;125778ec&amp;nbsp;&amp;nbsp;&amp;nbsp; 48015&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 768240 System.Collections.Specialized.NameObjectCollectionBase+NameObjectEntry&lt;br&gt;120261c8&amp;nbsp;&amp;nbsp;&amp;nbsp; 65842&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 790104 System.Boolean&lt;br&gt;14a2ee7c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9198&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 809424 System.Web.UI.WebControls.Table&lt;br&gt;14b311c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9647&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 810348 System.Web.UI.WebControls.Image&lt;br&gt;13a2b7dc&amp;nbsp;&amp;nbsp;&amp;nbsp; 34913&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 837912 System.Web.HttpServerVarsCollectionEntry&lt;br&gt;14b303a4&amp;nbsp;&amp;nbsp;&amp;nbsp; 10605&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 848400 System.Web.UI.WebControls.HyperLink&lt;br&gt;14d8e3d4&amp;nbsp;&amp;nbsp;&amp;nbsp; 77748&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 932976 Microsoft.Web.UI.WebControls.BaseChildNodeCollection+ActionType&lt;br&gt;14db90ac&amp;nbsp;&amp;nbsp;&amp;nbsp; 81372&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 976464 System.Web.UI.WebControls.FontInfo&lt;br&gt;14b30694&amp;nbsp;&amp;nbsp;&amp;nbsp; 28648&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1031328 System.Web.UI.WebControls.TableRow+CellControlCollection&lt;br&gt;14d8fdbc&amp;nbsp;&amp;nbsp;&amp;nbsp; 38912&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1089536 Microsoft.Web.UI.WebControls.TreeNodeCollection&lt;br&gt;14b3d0bc&amp;nbsp;&amp;nbsp;&amp;nbsp; 86592&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1385472 System.Web.UI.Pair&lt;br&gt;1466c5c4&amp;nbsp;&amp;nbsp;&amp;nbsp; 39305&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1414980 System.Web.UI.ControlCollection&lt;br&gt;14d8e48c&amp;nbsp;&amp;nbsp;&amp;nbsp; 77748&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1865952 Microsoft.Web.UI.WebControls.BaseChildNodeCollection+Action&lt;br&gt;1545061c&amp;nbsp;&amp;nbsp;&amp;nbsp; 38874&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2176944 Microsoft.Web.UI.WebControls.TreeNode&lt;br&gt;14b30eec&amp;nbsp;&amp;nbsp;&amp;nbsp; 52668&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2317392 System.Web.UI.WebControls.TableItemStyle&lt;br&gt;14a2f804&amp;nbsp;&amp;nbsp;&amp;nbsp; 28515&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2395260 System.Web.UI.WebControls.TableRow&lt;br&gt;14a2be6c&amp;nbsp;&amp;nbsp;&amp;nbsp; 40894&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2453640 System.Web.UI.LiteralControl&lt;br&gt;0fd3da00&amp;nbsp;&amp;nbsp; 228792&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2745504 System.Int32&lt;br&gt;14b3e3ac&amp;nbsp;&amp;nbsp; 244793&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2937516 System.Web.UI.IndexedString&lt;br&gt;14a2de94&amp;nbsp;&amp;nbsp; 198580&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3177280 System.Web.UI.StateBag&lt;br&gt;1466c454&amp;nbsp;&amp;nbsp;&amp;nbsp; 80512&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3542528 System.Web.UI.Control+OccasionalFields&lt;br&gt;12302c2c&amp;nbsp;&amp;nbsp; 205849&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4116980 System.Collections.Specialized.HybridDictionary&lt;br&gt;14b30024&amp;nbsp;&amp;nbsp;&amp;nbsp; 52934&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4446456 System.Web.UI.WebControls.TableCell&lt;br&gt;12302f2c&amp;nbsp;&amp;nbsp; 178294&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4992232 System.Collections.Specialized.ListDictionary&lt;br&gt;14a2e284&amp;nbsp;&amp;nbsp; 412762&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6604192 System.Web.UI.StateItem&lt;br&gt;14d8ce64&amp;nbsp;&amp;nbsp; 117078&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7024680 Microsoft.Web.UI.WebControls.CssCollection&lt;br&gt;0fd314bc&amp;nbsp;&amp;nbsp; 132065&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7395640 System.Collections.Hashtable&lt;br&gt;1230319c&amp;nbsp;&amp;nbsp; 422580&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8451600 System.Collections.Specialized.ListDictionary+DictionaryNode&lt;br&gt;1202a58c&amp;nbsp;&amp;nbsp; 380438&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9130512 System.Collections.ArrayList&lt;br&gt;0fd32050&amp;nbsp;&amp;nbsp; 133000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22582944 System.Collections.Hashtable+bucket[]&lt;br&gt;02c3896c&amp;nbsp;&amp;nbsp; 649842&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23275900 System.Object[]&lt;br&gt;0fd3c12c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3471&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36385536 System.Byte[]&lt;br&gt;001fee20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 338&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 65409920&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Free&lt;br&gt;02c39310&amp;nbsp;&amp;nbsp; 683083&amp;nbsp;&amp;nbsp;&amp;nbsp; 161821000 System.String&lt;br&gt;Total 5515837 objects&lt;br&gt;Fragmented blocks larger than 0.5 MB:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Addr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Followed by&lt;br&gt;2adf31cc&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.0MB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2aff85d8 System.String&lt;br&gt;2b006a2c&amp;nbsp;&amp;nbsp; 20.3MB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2c4530d8 System.Net.SocketAddress&lt;/div&gt; &lt;p&gt;As you can see we now get a listing sorted by size of all object-types on the heap. You'll usually find strings down at the bottom since that's what is commonly used the most.&lt;/p&gt; &lt;p&gt;Other useful arguments are -type and -mt (which stands for MethodTable). Using them you're able to see all objects of a specific type. For example. If we want to look at all HttpRequestCreators on the heap (there are one) you'll simply copy it's MethodTable which you'll find in the listing above (14ef4718) and use !dumpheap -mt&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dumpheap -mt 14ef4718&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;0342ccf8 14ef4718&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 1 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;total 1 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;14ef4718&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Net.HttpRequestCreator&lt;/div&gt; &lt;p&gt;This gives us the address of the object and if we'd like to inspect it closer we simply use !dumpobject on that address.&lt;/p&gt; &lt;p&gt;!dumpheap -type works pretty much the same way, except this time you filter the results by class name. !dumpheap -type performs a substring match, so if you write !dumpheap -type System.Web you'll get every object who's class name contains System.Web, which would be a lot.&lt;/p&gt; &lt;p&gt;Other useful arguments are -min and -max which accept a number representing the minimum/maximum number of bytes the object size should be. This can be really useful when troubleshooting string-abuse, etc. Also !dumpheap -stat -min 85000 would list all objects on the large object heap.&lt;/p&gt; &lt;h1&gt;Putting the tools to use&lt;/h1&gt; &lt;p&gt;I'd now like to use the commands we've covered in a bit more practical scenario. The dump we've been looking at is from a previous case of mine. The application in question was running on a Web garden with two workerprocesses. Session State was handled by a SQL Server. The customer was experiencing performance issues and the problem description was hazy at best. Anyway I had tons of dumps to work with, so I simply poked around to see what I could find. One thing I did pretty early on was to look at caching. According to the customer&amp;nbsp;they weren't using the cache at all, but I usually find it best to double-check this type of thing.&lt;/p&gt; &lt;h2&gt;Determining the size of the cache&lt;/h2&gt; &lt;p&gt;To find out how much data was kept in the cache I first needed to find the System.Web.Caching.Cache class.&amp;nbsp;So I ran !dumpheap -stat -type System.Web.Caching.Cache. Note that I also used the -stat argument. Otherwise I would have gotten a very long list of System.Web.Caching.CacheKeys and System.Web.Caching.CacheEntrys as well. Anyway, here's the result:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dumpheap -type System.Web.Caching.Cache -stat&lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;total 665 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;total 1084 objects&lt;br&gt;------------------------------&lt;br&gt;total 1749 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;123056f8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Web.Caching.CacheKeyComparer&lt;br&gt;&lt;font color="#ff0000"&gt;1230494c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Web.Caching.Cache&lt;br&gt;&lt;/font&gt;1230500c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24 System.Web.Caching.CacheMultiple&lt;br&gt;1230514c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 32 System.Web.Caching.CacheMemoryStats&lt;br&gt;123053b4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36 System.Web.Caching.CacheMemoryTotalMemoryPressure&lt;br&gt;123059bc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40 System.Web.Caching.CacheUsage&lt;br&gt;12304bdc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 48 System.Web.Caching.CacheCommon&lt;br&gt;123054f4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 52 System.Web.Caching.CacheMemoryPrivateBytesPressure&lt;br&gt;12305874&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 64 System.Web.Caching.CacheExpires&lt;br&gt;12304e64&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200 System.Web.Caching.CacheSingle&lt;br&gt;1255b594&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 85&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1360 System.Web.Caching.CacheDependency+DepFileInfo&lt;br&gt;123046c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1440 System.Web.Caching.CacheDependency&lt;br&gt;123042ec&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1504 System.Web.Caching.CacheItemRemovedCallback&lt;br&gt;123063fc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 832&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16640 System.Web.Caching.CacheKey&lt;br&gt;12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 732&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 52704 System.Web.Caching.CacheEntry&lt;br&gt;Total 1749 objects&lt;/div&gt; &lt;p&gt;Okay, so now I had the MethodTable for the System.Web.Caching.Cache object. Therefore I could now get the address to the object itself. I did this by asking !dumpheap to list all the objects on the heap with that MethodTable. I knew that there was just going to be one hit:&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dumpheap -mt 1230494c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;&lt;font color="#ff0000"&gt;03392d20&lt;/font&gt; 1230494c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 1 objects&lt;br&gt;------------------------------&lt;br&gt;Heap 1&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;total 0 objects&lt;br&gt;------------------------------&lt;br&gt;total 1 objects&lt;br&gt;Statistics:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Count&amp;nbsp;&amp;nbsp;&amp;nbsp; TotalSize Class Name&lt;br&gt;1230494c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12 System.Web.Caching.Cache&lt;br&gt;Total 1 objects&lt;/div&gt; &lt;p&gt;So now I ran !objsize on this object to see how big it was. This took a little time to calculate, since the cache is quite complex and there are a lot of children to iterate through.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !objsize 03392d20 &lt;br&gt;sizeof(03392d20) =&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ff0000"&gt;266640828&lt;/font&gt; (&amp;nbsp;&amp;nbsp; 0xfe49dbc) bytes (System.Web.Caching.Cache)&lt;/div&gt; &lt;p&gt;So the cache is 266 MB in size. That's quite a lot&amp;nbsp;considering the fact that the customer claimed that they weren't using the cache at all!&lt;/p&gt; &lt;h2&gt;What is being cached?&lt;/h2&gt; &lt;p&gt;To sample what the customer was caching I then took a look at a few of the CacheEntrys. I already had the MethodTable for the System.Web.Caching.CacheEntry from when I ran !dumpheap -type System.Web.Caching.Cache -stat (above), so I could use that to retrieve all CacheEntrys.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !dumpheap -mt 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;------------------------------&lt;br&gt;Heap 0&lt;br&gt;Address&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Size&lt;br&gt;033950bc 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;033a20d8 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;033ac79c 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;033da21c 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;033f04c4 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03428ec8 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;0344dab4 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03815d00 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;038265d8 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;....etc...&lt;br&gt;03af7010 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03b291bc 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03b2c674 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03b6dca0 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03b797dc 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03b85318 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03ba9150 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03c258cc 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;03de43c8 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;font color="#ff0000"&gt;03e160f8&lt;/font&gt; 12306820&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 72&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;total 382 objects&lt;br&gt;------------------------------&lt;br&gt;total 732 objects&lt;/div&gt; &lt;p&gt;Another valid command that would have given me the exact same output would off course have been !dumpheap -type System.Web.Caching.CacheEntry.&lt;/p&gt; &lt;p&gt;Okay, so now I had a long list of CacheEntrys. To sample the contents I just picked an address and examined it by using !dumpobject&lt;/p&gt; &lt;div class="DebugSample"&gt;0:050&amp;gt; !do 03b2c674 &lt;br&gt;Name: System.Web.Caching.CacheEntry&lt;br&gt;MethodTable: 12306820&lt;br&gt;EEClass: 122f6470&lt;br&gt;Size: 72(0x48) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;02c39310&amp;nbsp; 4001327&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.String&amp;nbsp; 0 instance 03b2c600 _key&lt;br&gt;0fb8f1f8&amp;nbsp; 4001328&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Byte&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 _bits&lt;br&gt;0fd3da00&amp;nbsp; 4001329&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 0 instance -1314181915 _hashCode&lt;br&gt;&lt;font color="#ff0000"&gt;02c36ca0&amp;nbsp; 4001330&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object&amp;nbsp; 0 instance 03b2c644 _value&lt;br&gt;&lt;/font&gt;120219d0&amp;nbsp; 4001331&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DateTime&amp;nbsp; 1 instance 03b2c690 _utcCreated&lt;br&gt;120219d0&amp;nbsp; 4001332&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DateTime&amp;nbsp; 1 instance 03b2c698 _utcExpires&lt;br&gt;1202af88&amp;nbsp; 4001333&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.TimeSpan&amp;nbsp; 1 instance 03b2c6a0 _slidingExpiration&lt;br&gt;0fb8f1f8&amp;nbsp; 4001334&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Byte&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7 _expiresBucket&lt;br&gt;123062d8&amp;nbsp; 4001335&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 34 ...g.ExpiresEntryRef&amp;nbsp; 1 instance 03b2c6a8 _expiresEntryRef&lt;br&gt;0fb8f1f8&amp;nbsp; 4001336&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Byte&amp;nbsp; 0 instance 4294967295 _usageBucket&lt;br&gt;12306738&amp;nbsp; 4001337&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 38 ...ing.UsageEntryRef&amp;nbsp; 1 instance 03b2c6ac _usageEntryRef&lt;br&gt;120219d0&amp;nbsp; 4001338&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DateTime&amp;nbsp; 1 instance 03b2c6b0 _utcLastUpdate&lt;br&gt;123046c4&amp;nbsp; 4001339&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14 ...g.CacheDependency&amp;nbsp; 0 instance 00000000 _dependency&lt;br&gt;02c36ca0&amp;nbsp; 400133a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object&amp;nbsp; 0 instance 033d8344 _onRemovedTargets&lt;br&gt;120219d0&amp;nbsp; 400132d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1bc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DateTime&amp;nbsp; 1&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static NoAbsoluteExpiration&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:03395104 &amp;lt;&amp;lt;&lt;br&gt;1202af88&amp;nbsp; 400132e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.TimeSpan&amp;nbsp; 1&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static NoSlidingExpiration&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:03395114 &amp;lt;&amp;lt;&lt;br&gt;1202af88&amp;nbsp; 400132f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.TimeSpan&amp;nbsp; 1&amp;nbsp;&amp;nbsp; shared&amp;nbsp;&amp;nbsp; static OneYear&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt; Domain:Value&amp;nbsp; 0019daf0:NotInit&amp;nbsp; 11b42540:03395124 &amp;lt;&amp;lt;&lt;/div&gt; &lt;p&gt;This dumped the&amp;nbsp;CacheEntry and it's properties. I figured the most interesting piece of information would be the _value, so&amp;nbsp;I simply copied the address of that property (look in the Value column) and used !dumpobject again.&lt;/p&gt; &lt;div class="DebugSample"&gt;0:000&amp;gt; !do 03e160c8 &lt;br&gt;&lt;font color="#ff0000"&gt;Name: System.Web.SessionState.InProcSessionState&lt;br&gt;&lt;/font&gt;MethodTable: 14dbad5c&lt;br&gt;EEClass: 14e43af8&lt;br&gt;Size: 48(0x30) bytes&lt;br&gt;(C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)&lt;br&gt;Fields:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT&amp;nbsp;&amp;nbsp;&amp;nbsp; Field&amp;nbsp;&amp;nbsp; Offset&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Type VT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attr&amp;nbsp;&amp;nbsp;&amp;nbsp; Value Name&lt;br&gt;1466c9d8&amp;nbsp; 4001d89&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4 ...ateItemCollection&amp;nbsp; 0 instance 1a7f5438 _sessionItems&lt;br&gt;1292672c&amp;nbsp; 4001d8a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8 ...ObjectsCollection&amp;nbsp; 0 instance 00000000 _staticObjects&lt;br&gt;0fd3da00&amp;nbsp; 4001d8b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20 _timeout&lt;br&gt;120261c8&amp;nbsp; 4001d8c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Boolean&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 _locked&lt;br&gt;120219d0&amp;nbsp; 4001d8d&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DateTime&amp;nbsp; 1 instance 03e160e4 _utcLockDate&lt;br&gt;0fd3da00&amp;nbsp; 4001d8e&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 _lockCookie&lt;br&gt;1202bf60&amp;nbsp; 4001d8f&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24 ...ReadWriteSpinLock&amp;nbsp; 1 instance 03e160ec _spinLock&lt;br&gt;0fd3da00&amp;nbsp; 4001d90&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Int32&amp;nbsp; 0 instance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 _flags&lt;/div&gt; &lt;p&gt;Here I found something interesting. The value stored was in fact an InProcSessionState object, which -in case&amp;nbsp;you didn't know this before- is stored in the Cache.&amp;nbsp;This meant that the claim that the application was using SQL Server Session state was incorrect. &lt;/p&gt; &lt;p&gt;As it turned out the customer had temporarily switched to In-process for a brief test, but forgotten to switch back again. Had the application been live they would have spotted this in no time, but since they were stress testing they weren't really paying attention to &lt;em&gt;what&lt;/em&gt; the server was returning as long as it returned &lt;em&gt;something&lt;/em&gt;. Unknowingly running session state in-process compromised the stress-test in a number of ways.&amp;nbsp;For example:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Memory usage for the worker process was a lot higher than expected&lt;/li&gt; &lt;li&gt;The load on the network was not as high as it would be under normal circumstances&lt;/li&gt; &lt;li&gt;The response times were no longer accountable&lt;/li&gt; &lt;li&gt;The SQL-server was not stressed to the extent it should have been, so any potential bottlenecks there went unnoticed&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This was in no way the final solution for their performance issue. There were a lot more things we had to deal with, but I think it's a really nice example of how to use only three commands (!dumpheap, !objsize &amp;amp; !dumpobject) to dig up some really useful information.&lt;/p&gt; &lt;p&gt;Later! / Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6531187" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/SessionState/default.aspx">SessionState</category><category domain="http://blogs.msdn.com/johan/archive/tags/WinDbg/default.aspx">WinDbg</category><category domain="http://blogs.msdn.com/johan/archive/tags/Managed+Heap/default.aspx">Managed Heap</category><category domain="http://blogs.msdn.com/johan/archive/tags/Tools/default.aspx">Tools</category><category domain="http://blogs.msdn.com/johan/archive/tags/Cache/default.aspx">Cache</category><category domain="http://blogs.msdn.com/johan/archive/tags/Debugging+School/default.aspx">Debugging School</category><category domain="http://blogs.msdn.com/johan/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>