ASP.NET 2.0 Crash case study: Unhandled exceptions


For a long time all my case studies have been on 1.1. it’s time to venture out in 2.0 land and look at what may seem like a 2.0 specific issue.

 

I say “may seem” because this case study will only directly crash if you are using 2.0, but as you’ll learn later the problem existed in 1.1 and 1.0, it was just way harder to track down.

 

Problem description:

 

Once in a while ASP.NET crashes and we see events in the system event log like this one

 

Event Type:       Warning
Event Source:    W3SVC
Event Category: None
Event ID:          1009
Date:               
2006-04-25
Time:               
09:41:22
PM User:           N/A
Computer:        
SUBSPACE1
Description:
A process serving application pool
‘ASP.NET V2.0’ terminated unexpectedly. The process id was ‘1732’. The process exit code was ‘0xe0434f4d’.

 

Or this one

 

Event Type:       Warning

Event Source:    W3SVC

Event Category: None

Event ID:          1011

Date:                2006-04-25

Time:                09:41:22

User:                N/A

Computer:         SUBSPACE1

Description:

A process serving application pool ‘ASP.NET V2.0’ suffered a fatal communication error with the World Wide Web Publishing Service. The process id was ‘6256’. The data field contains the error number.

 

And in the application event log we get a pretty cryptic error message like this one

 

Event Type:       Error

Event Source:    .NET Runtime 2.0 Error Reporting

Event Category: None

Event ID:          5000

Date:                2006-04-25

Time:                09:41:20

User:                N/A

Computer:         SUBSPACE1

Description:

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 app_code.pn5mfdcr, P5 0.0.0.0, P6 444dcf44, P7 5, P8 5, P9 system.dividebyzeroexception, P10 NIL.

 

 

Initial thoughts:

 

Ok, so what do we know about the issue?  We know that asp.net terminated unexpectedly, and that right before this we got a System.DivideByZeroException…. We also know that the process exit code was 0xe0434f4d whatever that means, hmm…

 

Usually when you get a stopped unexpectedly error message the exit code will be the type of exception that caused the crash.  For example a 0xC0000005 means you got a second chance access violation, 0x800703e9 means you suffered a StackOverflowException but what about 0xe0434f4d? 

 

0xe0434f4d is the exception code for CLR (.net) exceptions, so any managed exception like a NullReferenceException or InvalidOperationException or SQLException… basically all managed exception are natively referred to as 0xe0434f4d.  In this case, if we look closer at the application event log entry we can see that it is in fact a System.DivideByZero exception.

 

Trivia: Just a piece of info of no particular value that you might want to pull out of pocket on your next dateJ 0xe0434f4d or at least 43 4f 4d  are the ASCII values for the letters COM.

 

But hey now… should a .net exception cause the asp.net process to crash???  If you divide by zero in your page and don’t have a try catch block around it, surely you will get one of those “nice” white and yellow error pages saying that an exception occurred on your page, but the process doesn’t just exit. 

 

The answer is yes, you will get one of those pages because the asp.net global error handler will eventually catch your exception, format it for you and print it out on the screen.  But what happens if it is not on an asp.net request, so there is no-one to feedback the exception to? It’s the old paradox: If a tree falls in the forest and nobody is there, does it still make a sound? 

 

In 1.0 and 1.1 it didn’t.  For example if you throw an exception in a piece of code called on a timer, or use QueueUserWorkItem and throw an exception in code executing there, or otherwise throw exceptions in code that is not running inside the context of an asp.net request, the framework will swallow the exception and continue. Or rather it will stop that thread of execution but it won’t die.

 

Doesn’t sound all that bad right?  Really??? 

 

That thread could have been doing anything, and we will never be the wiser that it died.  It could have been holding a lock of some sort, or it could have been in the middle of cleaning up resources, or really a number of different things that will now never happen, but that may immediately or eventually have really bad side effects like hangs or crashes or memory issues, but the exception will be long gone so we cant figure out what it was.

 

The policy for unhandled exceptions was changed in ASP.NET 2.0 to the default for .net which is a process exit.  This can be changed back by adding the following to the aspnet.config in the frameworks directory, but I wouldn’t recommend it without putting in some preventive measures to take care of potential unhandled exceptions on non ASP.NET threads.

 

<configuration>

<runtime>

<legacyUnhandledExceptionPolicy enabled=”true” />

</runtime>

</configuration>

 

Troubleshooting the issue:

 

The main task here is to find out where this DivideByZero exception is coming from and why it occurred so there are two ways to figure this out (short of complete code inspection). 

 

Strategy #1 – logging the exception

 

The first way, and this is the way I would probably recommend, is to create an UnhandledExceptionHandler to log the exception along with its stack trace in the event log as shown in this article http://support.microsoft.com/?id=911816

 

You add the handler like this to the web.config:

 

    <system.web>

      <httpModules>

        <add type=WebMonitor.UnhandledExceptionModule, <strong name> name=UnhandledExceptionModule/>

      </httpModules>

         

    </system.web>

 

And it hooks an eventhandler up to the UnhandledException event of the current app domain.

 

You don’t actually need to strong name it and add it to the GAC, however if you plan it in multiple applications you should to avoid for the dll being loaded multiple times.

 

Now the next time you get one of these unhandled exceptions, the process will still exit (unless you change the unhandled exception policy), but you have a very good chance of fixing the issue.

 

The event for the exception in this particular sample looks like this…

 

Event Type:       Error

Event Source:    ASP.NET 2.0.50727.0

Event Category: None

Event ID:         0

Date:                2006-04-25

Time:                09:41:20

User:                N/A

Computer:         SUBSPACE1

Description:

 

UnhandledException logged by UnhandledExceptionModule.dll:

 

appId=/LM/w3svc/1/ROOT/CrashMe

 

type=System.DivideByZeroException

 

message=Attempted to divide by zero.

 

stack=

   at MyFinalizerClass.Finalize()

 

.

 

Bingo!!! So the exception occurs in MyFinalizerClass.Finalize() in the CrashMe application.

 

In fact the code for the finalizer for this class looks like this, so it is pretty obvious what caused it, and our work here is done…

 

    ~MyFinalizerClass()

    {

        int i = 0;

        int j = 9;

        i = j / i;

    }

 

Setting up an UnhandledException handler like this is not limited to 2.0. You can absolutely do this in 1.1 as well to determine if you are throwing any unhandl

Comments (84)

  1. Thank you for taking the time to write these articles.  Before reading your side, I’d never really comprehended windbg.  Your articles helped me use windbg to diagnose and solve some managed memory leaks in my code.  In previous positions, I’d used Rational Purify to find them, but windbg seems better to me for finding leaks.

  2. HUgh says:

    Your blog rocks! It’s indeed much better than many debugging books out there. I really like the way you present the problem and how you approach it mostly with the help of windbg. Reading your blogs has given me very good perspectives on what’s under the covers.

    Please keep those coming.

  3. WWs Blog says:

    Have you ever experienced the 0xe0434f4d exit code and thought, what the heck is that!

    Tess has a nice…

  4. WW says:

    Tess, your blog is great. It has helped me out a lot, especially this post. Keep it going!

  5. This is very cool.  Thanks for your hard work putting this together!

  6. This is a basic article but never the less it seems that many ASP.NET programmer don’t know issue like this.

    Tess I really think that you are doing a great job in advancing the debugging operation made by ASP.NET developers.

    ASP.NET developer have to understand that they must understand the concept of debugging because sooner or later they will come into the situation that they will face a problem that have to be debugged.

    Thank you and keep the good job 🙂

  7. I came across this post about dealing with unhandled ASP .NET exceptions on the blog of one of the Microsoft…

  8. Dan says:

    TCPView

    TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints…

  9. rahulso says:

    Awsome!!!!!!!!!!!!

    Your’s indeed is the best blog on debugging I have ever come across. Please keep them coming :o)

  10. random says:

    unintelligible

  11. Рекомендую почитать блог &amp;laquo;If broken it is, fix it you should&amp;raquo;. Детально рассматриваются различные…

  12. Tłumaczenie rewelacyjnego tekstu Tess Ferrandez o radzeniu sobie z wyjątkami, kt&#243;re nie sa tak do końca oczywiste i co najgorsze są przed nami ukryte.

  13. The following links to .NET resources have been collated over time with the assistance of

    colleagues.&amp;nbsp;…

  14. Tess really has the best blog I’ve seen that discusss how to investigate runtime issues with ASP.NET.&amp;nbsp;…

  15. Trackback from dotnetkicks.com

  16. ASP.Net says:

    I came across a great article that discusses how to investigate runtime issues with ASP.NET.&amp;nbsp; Tess&amp;nbsp;is…

  17. TCPView

    TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints…

  18. GB says:

    Hi Tess, I’ve got a dump from an ASP.NET app that is not crashing, but it becomes extremely slow for apparently no reason. The # of connections to IIS grows, and the users get no response from the server, although CPU and memory comsumption are low, and things only get back to normal with an app pool restart. I’ve got the dump with IIS Debug&Diag Tools, and the report shows for several (24) threads that "this thread is blocked by an unhandled exception". !threads shows that of the 36 threads listed, 24 have Lock Count = 1 and Exception = "(Threadpool Worker) System.ArgumentException". I’ve located the exception for one of those threads with !dso and !do to use what you’ve shown in the post, but _remoteStackTraceString is 0x00000000. What does that mean? And how can a thread be blocked by an unhandled exception? The app is .NET 1.1 SP1. Shouldn’t the framework "swallow" the exception as you said? One more thing that could be related: the app is sending e-mail messages to warn some people about unhandled exceptions, via the global ASP.NET exception handler, and this handler has been quite busy with the ThreadAbortExceptions generated by Response.Redirect. Thanks for any help on this….

  19. Tess says:

    Hi GB,

    Perhaps you can show the stack of one of the blocked threads, that would help determining why it is blocked (both !clrstack and kb, but you can mark out any proprietary information if you want with some suitable marker like ##### or something).  

    Member variables of exceptions (such as remotestacktracestring) are not always filled in, particularly the remote stack trace is not relevant to an ArgumentException, it is just an inherited member.  There should be a _StackTraceString, but if you are in the middle of the exception it might not be filled out yet. If that is the case you can get the stack directly by doing !clrstack or !dumpstack

  20. GB says:

    Hi Tess!!!

    Thanks for the atention. The stack is listed bellow:

    0:051> kb

    ChildEBP RetAddr  Args to Child              

    06e0e4e8 7c931b34 7c916b24 ffffffff 79213ebe ntdll!KiFastSystemCallRet

    06e0e4ec 7c916b24 ffffffff 79213ebe 00000000 ntdll!NtQueryVirtualMemory+0xc

    06e0e54c 7c9240b3 79213ebe 00000000 1433329c ntdll!RtlIsValidHandler+0x82

    06e0e5c0 7c93eda4 06e0a000 06e0e5d0 00010007 ntdll!RtlDispatchException+0x78

    06e0e8a0 7c815dea 06e0e8b0 04961118 e0434f4d ntdll!RtlRaiseException+0x3d

    06e0e900 79216aed e0434f4d 00000001 00000000 kernel32!RaiseException+0x53

    06e0e958 7924c8d0 10824018 00000000 00000000 mscorsvr!RaiseTheException+0xa0

    06e0e9c4 0434da75 06e0e9fc 1433329c 10823ed8 mscorsvr!JIT_Throw+0x4d

    WARNING: Frame IP not in any known module. Following frames may be wrong.

    06e0e9c8 06e0e9fc 1433329c 10823ed8 18671934 0x434da75

    06e0e9cc 1433329c 10823ed8 18671934 03f3b330 0x6e0e9fc

    06e0e9fc 03f3b178 06e0ea54 1c889210 18660d04 0x1433329c

    06e0ea00 06e0ea54 1c889210 18660d04 18672bac 0x3f3b178

    06e0ea04 1c889210 18660d04 18672bac 04759350 0x6e0ea54

    06e0ea54 047592ae 0475a675 047580e0 06e0eb08 0x1c889210

    06e0ea58 0475a675 047580e0 06e0eb08 108eb5e4 0x47592ae

    06e0ea5c 047580e0 06e0eb08 108eb5e4 1078f7d8 0x475a675

    06e0ea60 06e0eb08 108eb5e4 1078f7d8 1c72fa10 0x47580e0

    06e0ea64 108eb5e4 1078f7d8 1c72fa10 00000001 0x6e0eb08

    06e0ebcc 799a67a2 108e64d4 108e67d8 799b4168 0x108eb5e4

    06e0ebd8 799b4168 00000002 00000000 020b480c mscorlib_79990000+0x167a2

    0:051> !dumpstack -ee

    Thread 51

    Current frame:

     ChildEBP RetAddr    Caller,Callee

    06e0e920 799a3ed5 (MethodDesc 0x79b96470 +0x115 System.Text.StringBuilder.Append)

    06e0e9b4 0434df05 (MethodDesc 0x424e988 +0x55 System.Data.ExceptionBuilder.ColumnNotInTheTable)

    06e0e9c4 0434da75 (MethodDesc 0x40abb70 +0x7d System.Data.DataRow.IsNull)

    06e0e9d8 03f3b330 (MethodDesc 0x230e650 +0x20 SGI.Common.Library.getInt32)

    06e0e9fc 03f3b178 (MethodDesc 0x230e570 +0x250 SGI.Common.Library.ValidTypeProperty)

    06e0ea10 04759350 (MethodDesc 0x4741370 +0x88 SGI.Common.List.ReadProperties)

    06e0ea24 03f3fa32 (MethodDesc 0x3fbf3b0 +0x62 SGI.BusinessObject.Coorporativo.UnidadeFuncional..ctor)

    06e0ea44 0475d183 (MethodDesc 0x4748bb0 +0x4b SGI.BusinessObject.Academico.Turma..ctor)

    06e0ea54 047592ae (MethodDesc 0x4741380 +0x6 SGI.Common.List.getNext)

    06e0ea58 0475a675 (MethodDesc 0x4749df8 +0x5 SGI.BusinessObject.Academico.MatriculaInscritoList.SGI.Common.IObjectList.getNext)

    06e0ea5c 047580e0 (MethodDesc 0x230be30 +0x1c8 SGI.UI.Matricula.matricula.BindGradeHoraria)

    06e0ea8c 0475412a (MethodDesc 0x230bd30 +0x92 SGI.UI.Matricula.matricula.Page_Load)

    06e0ea9c 03fc3c3c (MethodDesc 0x22efcf0 +0x44 System.Web.UI.Control.OnLoad)

    06e0eab0 03fc3b84 (MethodDesc 0x22efd00 +0x24 System.Web.UI.Control.LoadRecursive)

    06e0eac4 03f49a7f (MethodDesc 0x23814d8 +0x2ef System.Web.UI.Page.ProcessRequestMain)

    06e0eaec 03f49547 (MethodDesc 0x2381368 +0x1f System.Web.UI.Page.set_FileDependencies)

    06e0eaf8 03f30442 (MethodDesc 0x230c708 +0x32 ASP.matricula_aspx.FrameworkInitialize)

    06e0eb08 03f472d7 (MethodDesc 0x2381498 +0x77 System.Web.UI.Page.ProcessRequest)

    06e0eb44 03f46d3b (MethodDesc 0x2381488 +0x13 System.Web.UI.Page.ProcessRequest)

    06e0eb4c 03f46d14 (MethodDesc 0x2387c50 +0xb4 System.Web.HttpApplication/CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute)

    06e0eb5c 03df9838 (MethodDesc 0x217d730 +0x58 System.Web.HttpApplication.ExecuteStep)

    06e0eba0 03df92a2 (MethodDesc 0x217d760 +0xfa System.Web.HttpApplication.ResumeSteps)

    06e0ebcc 799a67a2 (MethodDesc 0x79bc5b08 +0x12 System.Runtime.InteropServices.GCHandle..ctor)

    06e0ebd8 799b4168 (MethodDesc 0x79bc5b28 +0x10 System.Runtime.InteropServices.GCHandle.Alloc)

    06e0ebec 03df9173 (MethodDesc 0x217d800 +0xe3 System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest)

    06e0ec00 01fd68a7 (MethodDesc 0x1b59888 +0x1e7 System.Web.HttpRuntime.ProcessRequestInternal)

    06e0ec44 01fd6458 (MethodDesc 0x1b59988 +0xb0 System.Web.HttpRuntime.ProcessRequest)

    06e0ec50 01fd2fd5 (MethodDesc 0x1b584d0 +0x65 System.Web.Hosting.ISAPIRuntime.ProcessRequest)

    The exception:

    0:051> !do 0x10824018

    Name: System.ArgumentException

    MethodTable 0x79b9edec

    EEClass 0x79b9ee74

    Size 68(0x44) bytes

    GC Generation: 0

    mdToken: 0x0200003a  (c:windowsmicrosoft.netframeworkv1.1.4322mscorlib.dll)

    FieldDesc*: 0x79b9eed8

           MT      Field     Offset                 Type       Attr      Value Name

    0x79b96824 0x400001d      0x4                CLASS   instance 0x00000000 _className

    0x79b96824 0x400001e      0x8                CLASS   instance 0x00000000 _exceptionMethod

    0x79b96824 0x400001f      0xc                CLASS   instance 0x00000000 _exceptionMethodString

    0x79b96824 0x4000020     0x10                CLASS   instance 0x10823f34 _message

    0x79b96824 0x4000021     0x14                CLASS   instance 0x00000000 _innerException

    0x79b96824 0x4000022     0x18                CLASS   instance 0x00000000 _helpURL

    0x79b96824 0x4000023     0x1c                CLASS   instance 0x00000000 _stackTrace

    0x79b96824 0x4000024     0x20                CLASS   instance 0x00000000 _stackTraceString

    0x79b96824 0x4000025     0x24                CLASS   instance 0x00000000 _remoteStackTraceString

    0x79b96824 0x4000026     0x2c         System.Int32   instance 0 _remoteStackIndex

    0x79b96824 0x4000027     0x30         System.Int32   instance -2147024809 _HResult

    0x79b96824 0x4000028     0x28                CLASS   instance 0x00000000 _source

    0x79b96824 0x4000029     0x34         System.Int32   instance 0 _xptrs

    0x79b96824 0x400002a     0x38         System.Int32   instance -532459699 _xcode

    0x79b9edec 0x40000d7     0x3c                CLASS   instance 0x00000000 m_paramName

    —————–

    Exception 10824018 in MT 79b9edec: System.ArgumentException

    _message: A coluna ‘idSituacaoCurso’ não pertence à tabela Table.

    [OBS1. the _message means "The column ‘idSituacaoCurso’ does not belong to table Table".]

    [OBS2. I got the exception by running !dso and then !do on the only object listed by !dso that was an instance of Exception.]

    The customer gave me a PST Outlook file with the messages that the site generates on each unhandled exception. There were 16.000 (sixteen THOUSAND) messages on a five-day interval. So I monitored ".NET CLR Exceptions# of Exceps Thrown" and ".NET CLR Exceptions# of Exceps Thrown/s" with perfmon. The # of exceps thrown/s was at an average of 447 on a 9h30min interval, with maximum at 5.700. PER SECOND!!!! So looking at the code I saw that the SGI.Common.List.ReadProperties() method is extremely likely to be the cause of such a high exception count. But could this count be the cause of the blocked threads? I’m proposing a code change that will avoid this high exception count, but just looking at the dump I have no "black & white" explanation to relate the high exception count to the hung threads.

    Sorry to take advantage of your spare time like this…. It’s the price one pays for being famous 😉 – and kind enough to anwser the questions.

    Thanks again

    Gilberto

  21. Tess says:

    To be honest, the thread doesnt really appear to be stuck, but perhaps that message you are getting is due to the shear amount of exceptions you are getting.

    I think it is a fair assumption to make that this exception is probably common as the message seems to indicate that there is an error in the code (giving the wrong column name) which would occurr every time you go through this code path.  But to get a better understanding of what exceptions you get, you can run !DumpAllExceptions or !DumpAllExceptions -v to see what types of exceptions you have gotten recently and how many.  

    An educated guess would be that without the high amount of exceptions you will not be hung.  There is no other reason for the hung state on this thread.

    Thanks Tess

  22. GB says:

    Ok Tess,

    Thanks a lot. That’s was my conclusion too, I’m writing it now on my report. Perhaps I could quote you on this?…..

    😉 just kidding

    Thanks,

    GB

  23. Tess says:

    Feel free:)

  24. TM says:

    This helped us with part of our problem, but IIS keeps crashing over exception 0x00015dea.  I have been trying to figure out what this exception refers to, but I can’t find it.

  25. Tess says:

    Hi TM,

    To be honest that looks more like an address than an exit code or an exception code.  In fact that address often shows up as the faulting address in kernel32 during a fatal exception.

    I would run adplus straight up in crash mode (without any config files to begin with) and look at the dump that gets generated when the process exits, as well as the log files to look for strange exceptions before the exit.  

    HTH

  26. mash says:

    I’m a WinDbg newbie and your blog’s a life saver! Thanks!

    I’ve got a question…when I open crash dumps and run the "!threads" command, I see a list of threads along with the one that caused the exception. But unlike the examples stated in this blog, I don’t see the address of the function that caused the exception.

    Here’s the sample dump:

    0:000> !threads

    succeeded

    Loaded Son of Strike data table version 5 from "C:WINMDMicrosoft.NETFrameworkv1.1.4322mscorsvr.dll"

    ThreadCount: 7

    UnstartedThread: 0

    BackgroundThread: 5

    PendingThread: 0

    DeadThread: 2

                                PreEmptive   GC Alloc               Lock    

          ID ThreadOBJ    State     GC       Context       Domain   Count APT Exception

    XXX     0 0c9e0a20      1820 Enabled  00000000:00000000 000b0458     0 Ukn System.FormatException

  27. Tess says:

    Hi Mash,

    The exception address is only available in sos.dll for 2.0, and just in case you are debugging for the unhandled exception, that only happens in 2.0.

    But… if you are interested in that format exception you should be able to find it using !dumpheap -type FormatException

  28. Arnaut says:

    I’m getting the same error too. I’m also getting Thread aborts and a crashing IIS. I think the source is the .Redirect, because my application is logging this it’s own log in a database.

    Anyone found a solution for this?

  29. Tess says:

    A redirect would occurr on an ASP.NET thread and thus it would not crash the process.  

    It is normal for redirect to throw threadabort exceptions as it has to abort the code execution on the current thread, and this is unharmful, since we are aborting ourselfs and thus we can not be in a part of code where we are executing anything that can not be aborted.

    I think you need to look elsewhere for your crashing exception, a crash dump would probably be the best option.

  30. Arnaut says:

    Uhm, yes, your right. Saw that a couple of minutes ago. I’ve installed IIS diagnostics (max crash logging) and now it’s waiting for the next crash.

    Thanks for the quick reply!

  31. As part of my &quot;not-my-real-job&quot; time, I do a little website hosting – basically to keep my

  32. Howard says:

    This is more a general question about HttpModules, all the documentation seems to suggest that when you add an HttpModule to your web.config file you only get one single instance of your HttpModule per HttpApplication, is this really true?

    I’ve been running some load tests generating 1000s of requests and when I’ve windbg’d the worker process and done a dumpheap -type on my HttpModule class there’s loads of ’em. But if we’re only supposed to get one instance per HttpApplication, how’s this possible?

  33. Howard says:

    Actually it appears that ASP.NET creates a pool of HttpModules to handle multiple requests and the number created increases with load. I wonder what algorithm is used to determine how many instances of the HttpModule to create?

    So this would mean that the HttpModule code from the kb article will only work for the first instance of that particular HttpModule.

    Well, you learn something everyday day.

  34. Tess says:

    I am afraid I don’t follow you at all…

    What is the problem?  If you get an unhandled exception, this module will handle it whether there is a pool of such handlers or only one.  Are you seeing something different? I would be a bit surprised if you were…

  35. Howard says:

    What I mean’t was that in the kb article the code uses a static bool to determine whether the module has already been initialized and hence to hook up the event handlers or not in the Init() method.

    So when any subsequent instances of the module class are created this bool flag is already set to true. Which means these instances will not have event handlers set up for them.

    Well, thats what it seems like anyway, as a % of my requests don’t get processed. The first x number do, then it goes hit & miss. This only happens under heavy load, ie when I’ve got a pool of these handlers created. Everytime I’ve had a request that hasn’t been processed I’ve checked with !dumpheap -type and there’s always multiple instances of the module class.

    When I comment out the static bool flag all my requests get processed when it’s under load.

    Hope that makes sense.

  36. Joe says:

    Just in case anyone uses active reports, we ran across an issue where our application was terminating unexpectedly and it turned out to be related to a bug in their code.

    http://www.datadynamics.com/forums/3/96793/ShowPost.aspx#96793

  37. Warrier says:

    Hi Tess,

    I cannot use a debugger to troubleshoot the issue in this case. The HttpModule you referred to works for a ASP.NET app. Can you give me some idea on how to do this for a Windows Service (in 2.0) that is doing some async operations for TCP Sockets?

    Thanks,

    Warrier

  38. Tess says:

    Hi Warrier,

    Unfortunately a windows service is not "hosted" the same way that an asp.net app is so as you mentioned you don’t have the same harness of events, modules and handlers, so you would have to create a harness yourself which is not completely trivial (ok, understatement of the year:))  

    Where do you get the exceptions? Would it be possible to have exception handlers just around the code that makes the async operations?

  39. manche says:

    Hi Tess,

    I’m new to WinDbg and you blog was very helpful!

    I’ve got a question…When I run my application, the worker process crashes.. i started debugging using WinDbg..

    when I open crash dumps, following exceptions is shown

    In w3wp__PID__1368__Date__02_22_2007__Time_11_07_03AM__329__Second_Chance_Exception_E0434F4D.dmp the assembly instruction at kernel32!RaiseException+53 in C:WINDOWSsystem32kernel32.dll from Microsoft Corporation has caused a CLR Exception of type (System.CannotUnloadAppDomainException) on thread 14

    This exception originated from mscorwks!RaiseTheExceptionInternalOnly+226.

    Thread 14 – System ID 1568

    Entry point   mscorwks!ThreadpoolMgr::intermediateThreadProc

    Create time   2/22/2007 10:56:57 AM

    Time spent in user mode   0 Days 0:0:16.625

    Time spent in kernel mode   0 Days 0:0:25.46

    Function     Arg 1     Arg 2     Arg 3   Source

    kernel32!RaiseException+53     e0434f4d     00000001     00000001    

    mscorwks!RaiseTheExceptionInternalOnly+226     1d00e1d0     00000000     00000000    

    mscorwks!RaiseTheException+4c     1d00e1d0     00000000     019dfb68    

    mscorwks!RaiseTheException+be     00000000     000e1f00     b59aaf96    

    mscorwks!RealCOMPlusThrow+37     1d00e1d0     00000000     7a0e0701    

    mscorwks!RealCOMPlusThrow+a     1d00e1d0     b40c20e3     7a36a7d0    

    mscorwks!Thread::RaiseCrossContextException+63     00000000     019dfc18     019dfc88    

    mscorwks!Thread::DoADCallBack+26c     00000007     79f3a0a1     019dfd88    

    mscorwks!Thread::UserResumeThread+e1     019dfd88     019dfd34     79f93fe6    

    mscorwks!Thread::DoADCallBack+355     019dfd88     b40c26eb     00000001    

    mscorwks!Thread::DoADCallBack+541     019dfd88     00000007     00000000    

    mscorwks!Thread::DoADCallBack+575     00000007     7a07bd61     019dfdf8    

    mscorwks!ManagedThreadBase::ThreadPool+13     00000007     7a07bd61     019dfdf8    

    mscorwks!QueueUserWorkItemCallback+9d     00110a90     77e6bb9d     7a38e228    

    mscorwks!ThreadpoolMgr::ExecuteWorkRequest+40     08e67868     b40c2503     00000000    

    mscorwks!ThreadpoolMgr::WorkerThreadStart+1f2     00000000     00000000     00000000    

    mscorwks!ThreadpoolMgr::intermediateThreadProc+49     000c89a0     00000000     00000000    

    kernel32!BaseThreadStart+34     79f710dd     000c89a0     00000000    

    Using this information i am not able to figure out where the error is occured.

    Also I am creating timer on thread in ASP.Net application and the timer is disposed in Application_End event.

    Can you give me some idea where should i start looking inorder to resolve the issue?

    Thanks

    manche

  40. Tess says:

    You can try to run !threads to see what the last exception was on that thread and run !pe on it,  or run !dso to find the exception on the stack.  It is definitely an unhandled .net exception but it is not possible from the stack you sent to see what the exception was.

  41. manche says:

    Thanks for your response…

    0:014> !threads

    PDB symbol for mscorwks.dll not loaded

    ThreadCount: 10

    UnstartedThread: 0

    BackgroundThread: 10

    PendingThread: 0

    DeadThread: 0

    Hosted Runtime: no

                                         PreEmptive   GC Alloc           Lock

          ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception

     14    1  620 000e1f00   1808220 Enabled  00000000:00000000 000dee68     0 STA (Threadpool Worker) System.CannotUnloadAppDomainException (1d00e1d0)

     16    2  630 000ee228      b220 Enabled  00000000:00000000 000dee68     0 MTA (Finalizer)

     17    3  880 00101f60    80a220 Enabled  00000000:00000000 000dee68     0 MTA (Threadpool Completion Port)

     18    4  884 00105340      1220 Enabled  00000000:00000000 000dee68     0 Ukn

     12    5  1ec 05983130   880a220 Enabled  00000000:00000000 000dee68     0 MTA (Threadpool Completion Port)

     20    6  7c4 00176e68   180b220 Enabled  00000000:00000000 000dee68     0 MTA (Threadpool Worker)

     21    7  9c0 059def98   880b220 Enabled  00000000:00000000 000dee68     0 MTA (Threadpool Completion Port)

     25    a  e6c 08cf8f58   180b220 Enabled  00000000:00000000 109aedd0     1 MTA (Threadpool Worker)

     26    b  78c 08d80370   880b220 Enabled  00000000:00000000 000dee68     0 MTA (Threadpool Completion Port)

     28    c  f38 108e8770      7221 Enabled  00000000:00000000 1090fd38     0 STA

    0:014> !dso

    OS Thread Id: 0x620 (14)

    ESP/REG  Object   Name

    019df9f8 1d00e1d0 System.CannotUnloadAppDomainException

    019df9fc 1d00e1d0 System.CannotUnloadAppDomainException

    019dfa44 1d00e1d0 System.CannotUnloadAppDomainException

    019dfa58 1d00e1d0 System.CannotUnloadAppDomainException

    019dfaac 1d00e1d0 System.CannotUnloadAppDomainException

    019dfab8 1d00e1d0 System.CannotUnloadAppDomainException

    019dfb54 1cfe9cb4 System.CannotUnloadAppDomainException

    019dfb58 1d00cc54 System.Byte[]

    019dfb84 1d00e1d0 System.CannotUnloadAppDomainException

    019dfb88 1d00cc54 System.Byte[]

    019dfb98 1d00cc54 System.Byte[]

    019dfc24 022e5f28 System.Threading.ExecutionContext

    0:014> !pe

    Exception object: 1d00e1d0

    Exception type: System.CannotUnloadAppDomainException

    Message: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)

    InnerException: <none>

    StackTrace (generated):

    <none>

    StackTraceString: <none>

    HResult: 80131015

    0:014> !do 1d00e1d0

    Name: System.CannotUnloadAppDomainException

    MethodTable: 7915d434

    EEClass: 791e7ea4

    Size: 72(0x48) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    790fa3e0  40000b5        4        System.String  0 instance 1d00f048 _className

    79109208  40000b6        8 …ection.MethodBase  0 instance 00000000 _exceptionMethod

    790fa3e0  40000b7        c        System.String  0 instance 1d00f7d8 _exceptionMethodString

    790fa3e0  40000b8       10        System.String  0 instance 1d00f194 _message

    79113dfc  40000b9       14 …tions.IDictionary  0 instance 1d0104fc _data

    790fa9e8  40000ba       18     System.Exception  0 instance 00000000 _innerException

    790fa3e0  40000bb       1c        System.String  0 instance 00000000 _helpURL

    790f9c18  40000bc       20        System.Object  0 instance 00000000 _stackTrace

    790fa3e0  40000bd       24        System.String  0 instance 00000000 _stackTraceString

    790fa3e0  40000be       28        System.String  0 instance 1d011274 _remoteStackTraceString

    790fed1c  40000bf       34         System.Int32  0 instance        0 _remoteStackIndex

    790f9c18  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

    790fed1c  40000c1       38         System.Int32  0 instance -2146234347 _HResult

    790fa3e0  40000c2       30        System.String  0 instance 1d00fa2c _source

    790fe160  40000c3       3c        System.IntPtr  0 instance        0 _xptrs

    790fed1c  40000c4       40         System.Int32  0 instance        0 _xcode

    0:014> !do 1d00f048

    Name: System.String

    MethodTable: 790fa3e0

    EEClass: 790fa340

    Size: 92(0x5c) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    String: System.CannotUnloadAppDomainException

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    790fed1c  4000096        4         System.Int32  0 instance       38 m_arrayLength

    790fed1c  4000097        8         System.Int32  0 instance       37 m_stringLength

    790fbefc  4000098        c          System.Char  0 instance       53 m_firstChar

    790fa3e0  4000099       10        System.String  0   shared   static Empty

       >> Domain:Value  000dee68:790d6584 109aedd0:790d6584 05a4bf60:790d6584 08da9588:790d6584 08e39ef0:790d6584 108cb728:790d6584 1090fd38:790d6584 <<

    79124670  400009a       14        System.Char[]  0   shared   static WhitespaceChars

       >> Domain:Value  000dee68:022d13b8 109aedd0:02ae15b0 05a4bf60:023d4778 08da9588:024d163c 08e39ef0:025a5a2c 108cb728:0268db34 1090fd38:026ea248 <<

  42. manche says:

    Opps I accidently clicked on submit button..

    I have verified the code and all the threads are disposed. Can you find any details with the give information?

    Once again thanks for all your help…

    Thanks

    manche

  43. Tess says:

    Hi Manche,

    Try dumping out all the other members of the exception as well to see if they give any additional info.  If they don’t you might want to open a request with support if you want to troubleshoot it further, but the way it looks is like this might be a problem at shutdown and if you run ~* kb and ~* e !clrstack you may see some threads sitting in a hung state.

  44. Manche says:

    Hi Tess

    Thanks for your response.

    As per the following info, it looks like the error is thrown from an unmanaged code. In our application we are using a third pary component and its that which is causing the problem….

    0:014> ~*kb

      0  Id: 558.55c Suspend: 1 Teb: 7ffdf000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0006fc7c 77e6ba42 00000154 ffffffff 00000000 ntdll!KiFastSystemCallRet

    0006fc90 5a36467a 00000154 ffffffff 00000000 kernel32!WaitForSingleObject+0x12

    0006ff0c 0100187c 00000007 00253a68 00000000 w3dt!IPM_MESSAGE_PIPE::operator=+0x1b31

    0006ff44 01001a23 00000007 00253a68 002542e0 w3wp+0x187c

    0006ffc0 77e523e5 00000000 00000000 7ffda000 w3wp+0x1a23

    0006fff0 00000000 010018f8 00000000 78746341 kernel32!IsProcessorFeaturePresent+0x9e

      1  Id: 558.5ac Suspend: 1 Teb: 7ffdd000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    009bffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    009bffec 00000000 7c81fddf 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

      2  Id: 558.5c8 Suspend: 1 Teb: 7ffdc000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    009fffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    009fffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

      3  Id: 558.5dc Suspend: 1 Teb: 7ffdb000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00a5ff84 77c5778f 00a5ffac 77c5f7dd 000a56e8 ntdll!KiFastSystemCallRet

    00a5ff8c 77c5f7dd 000a56e8 00000000 00000000 rpcrt4!NdrOleFree+0x3c5

    00a5ffac 77c5de88 0008fdc0 00a5ffec 77e6608b rpcrt4!I_RpcTransGetThreadEvent+0x188

    00a5ffb8 77e6608b 000a5990 00000000 00000000 rpcrt4!I_RpcLogEvent+0xe92

    00a5ffec 00000000 77c5de6d 000a5990 00000000 kernel32!GetModuleFileNameA+0xeb

      4  Id: 558.5e0 Suspend: 1 Teb: 7ffd8000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00c5ff54 5a30249e 00000148 00c5ff7c 00c5ff80 ntdll!KiFastSystemCallRet

    00c5ff8c 5a3026bc 00000000 00258310 5a300000 w3tp!THREAD_POOL::PostCompletion+0x89

    00c5ffa0 5a301db9 00258238 00000000 00000000 w3tp!THREAD_POOL::~THREAD_POOL+0x153

    00c5ffb8 77e6608b 00258310 00000000 00000000 w3tp+0x1db9

    00c5ffec 00000000 5a301d80 00258310 00000000 kernel32!GetModuleFileNameA+0xeb

      5  Id: 558.5e4 Suspend: 1 Teb: 7ffd7000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00c9ff54 5a30249e 00000148 00c9ff7c 00c9ff80 ntdll!KiFastSystemCallRet

    00c9ff8c 5a3026bc 00000000 00258330 5a300000 w3tp!THREAD_POOL::PostCompletion+0x89

    00c9ffa0 5a301db9 00258238 00000000 00000000 w3tp!THREAD_POOL::~THREAD_POOL+0x153

    00c9ffb8 77e6608b 00258330 00000000 00000000 w3tp+0x1db9

    00c9ffec 00000000 5a301d80 00258330 00000000 kernel32!GetModuleFileNameA+0xeb

      6  Id: 558.5e8 Suspend: 1 Teb: 7ffd6000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00cdff54 5a30249e 00000148 00cdff7c 00cdff80 ntdll!KiFastSystemCallRet

    00cdff8c 5a3026bc 00000000 00258350 5a300000 w3tp!THREAD_POOL::PostCompletion+0x89

    00cdffa0 5a301db9 00258238 00000000 00000000 w3tp!THREAD_POOL::~THREAD_POOL+0x153

    00cdffb8 77e6608b 00258350 00000000 00000000 w3tp+0x1db9

    00cdffec 00000000 5a301d80 00258350 00000000 kernel32!GetModuleFileNameA+0xeb

      7  Id: 558.5f0 Suspend: 1 Teb: 7ffd5000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00d1ff54 5a30249e 00000148 00d1ff7c 00d1ff80 ntdll!KiFastSystemCallRet

    00d1ff8c 5a3026bc 00000000 00258370 5a300000 w3tp!THREAD_POOL::PostCompletion+0x89

    00d1ffa0 5a301db9 00258238 00000000 00000000 w3tp!THREAD_POOL::~THREAD_POOL+0x153

    00d1ffb8 77e6608b 00258370 00000000 00000000 w3tp+0x1db9

    00d1ffec 00000000 5a301d80 00258370 00000000 kernel32!GetModuleFileNameA+0xeb

      8  Id: 558.5f4 Suspend: 1 Teb: 7ffd4000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    00ddffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    00ddffec 00000000 7c83abb0 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

      9  Id: 558.5fc Suspend: 1 Teb: 7ffaf000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    017bfaf8 77e6ba42 000001b4 ffffffff 00000000 ntdll!KiFastSystemCallRet

    017bfb0c 5a3b8147 000001b4 ffffffff 00000000 kernel32!WaitForSingleObject+0x12

    017bffb8 77e6608b 00000000 00000000 00000000 w3core!W3_FILE_INFO_CACHE::GetFileCache+0xd784

    017bffec 00000000 5a3b8021 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     10  Id: 558.604 Suspend: 1 Teb: 7ffae000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    017fff84 77c5778f 017fffac 77c5f7dd 000a56e8 ntdll!KiFastSystemCallRet

    017fff8c 77c5f7dd 000a56e8 00000000 00000000 rpcrt4!NdrOleFree+0x3c5

    017fffac 77c5de88 0008fdc0 017fffec 77e6608b rpcrt4!I_RpcTransGetThreadEvent+0x188

    017fffb8 77e6608b 000b6298 00000000 00000000 rpcrt4!I_RpcLogEvent+0xe92

    017fffec 00000000 77c5de6d 000b6298 00000000 kernel32!GetModuleFileNameA+0xeb

     11  Id: 558.554 Suspend: 1 Teb: 7ffad000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0183ffb8 77e6608b 000bd918 00000000 00000000 ntdll!KiFastSystemCallRet

    0183ffec 00000000 7c815228 000bd918 00000000 kernel32!GetModuleFileNameA+0xeb

     12  Id: 558.1ec Suspend: 1 Teb: 7ffac000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0195fea8 79f2f30a 00000228 0195feec 0195fee8 ntdll!KiFastSystemCallRet

    0195ff14 79f71123 00000000 00000000 00000000 mscorwks!CreateAssemblyCache+0x2125c

    00000000 00000000 00000000 00000000 00000000 mscorwks!CompareAssemblyIdentity+0xd4f4

     13  Id: 558.208 Suspend: 1 Teb: 7ffab000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0199feb0 79f2c9f3 000001f4 00000000 b4082573 ntdll!KiFastSystemCallRet

    0199fee4 79f2c9c3 000001f4 00000000 b408248f mscorwks!CreateAssemblyCache+0x1e945

    0199ff18 79f758ec 000001f4 00000000 79f2c895 mscorwks!CreateAssemblyCache+0x1e915

    0199ffb8 77e6608b 00000000 00000000 00000000 mscorwks!CompareAssemblyIdentity+0x11cbd

    0199ffec 00000000 79f2c800 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

    # 14  Id: 558.620 Suspend: 1 Teb: 7ffaa000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    019df9dc 79f97065 e0434f4d 00000001 00000001 kernel32!RaiseException+0x3c

    019dfa3c 7a05b942 1d00e1d0 00000000 00000000 mscorwks!DllCanUnloadNowInternal+0x37a9

    019dfa78 7a05b9eb 00000000 000e1f00 b59aaf96 mscorwks!GetAddrOfContractShutoffFlag+0xa7d7

    019dfaa4 7a05b9f6 1d00e1d0 00000000 7a0e0701 mscorwks!GetAddrOfContractShutoffFlag+0xa880

    019dfbc8 79f993a2 019a1000 019e0000 019dfc88 mscorwks!GetAddrOfContractShutoffFlag+0xa88b

    00000000 00000000 00000000 00000000 00000000 mscorwks!DllCanUnloadNowInternal+0x5ae6

     15  Id: 558.624 Suspend: 1 Teb: 7ffa9000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    01abfedc 77e6109d 00000003 01abff20 00000000 ntdll!KiFastSystemCallRet

    01abfef8 79ed4b06 00000003 01abff20 00000000 kernel32!WaitForMultipleObjects+0x18

    01abff58 79ed4a63 b43a241f 00000000 00000000 mscorwks!InitializeFusion+0x266e

    01abff88 79ed49a6 b43a242f 00000000 00000000 mscorwks!InitializeFusion+0x25cb

    01abffb8 77e6608b 00000000 00000000 00000000 mscorwks!InitializeFusion+0x250e

    01abffec 00000000 79ed4960 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     16  Id: 558.630 Suspend: 1 Teb: 7ffa8000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    01bbfd78 77e6109d 00000002 7a381bb8 00000000 ntdll!KiFastSystemCallRet

    01bbfd94 79f8d98a 00000002 7a381bb8 00000000 kernel32!WaitForMultipleObjects+0x18

    01bbfdb4 79ea2e68 000ee1f8 01bbfe6c 01bbfeb4 mscorwks!StrongNameFreeBuffer+0x46b2

    01bbfdc8 79ecb4a4 01bbfeb4 00000000 00000001 mscorwks!CreateAssemblyNameObject+0x7fc

    00000000 00000000 00000000 00000000 00000000 mscorwks!CreateApplicationContext+0xc940

     17  Id: 558.880 Suspend: 1 Teb: 7ffa7000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    01c6ff34 79f446b6 0000059e 00000001 01c6ffa4 ntdll!KiFastSystemCallRet

    01c6ffb0 79f44647 00000000 77e6608b 019de77c mscorwks!GetMetaDataPublicInterfaceFromInternal+0xdf7

    01c6ffec 00000000 79f445ef 019de77c 00000000 mscorwks!GetMetaDataPublicInterfaceFromInternal+0xd88

     18  Id: 558.884 Suspend: 1 Teb: 7ffa6000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    01cafd2c 79e77fd1 000002c0 ffffffff 00000000 ntdll!KiFastSystemCallRet

    01cafd70 79e77f9a 000002c0 ffffffff 00000000 mscorwks!DllUnregisterServerInternal+0x47b1

    01cafdc0 79e77f50 ffffffff 00000000 00000000 mscorwks!DllUnregisterServerInternal+0x477a

    01cafe50 79e7839d 01cafde4 01cafde4 00105810 mscorwks!DllUnregisterServerInternal+0x4730

    01cafe60 79e782dc 00000000 00000001 00000001 mscorwks!DllUnregisterServerInternal+0x4b7d

    01cafe94 79ecb00b 00105340 00000000 00000000 mscorwks!DllUnregisterServerInternal+0x4abc

    01caffb8 77e6608b 00105810 00000000 00000000 mscorwks!CreateApplicationContext+0xc4a7

    01caffec 00000000 79ecafc5 00105810 00000000 kernel32!GetModuleFileNameA+0xeb

     19  Id: 558.ce0 Suspend: 1 Teb: 7ffa4000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    061cff6c 77e6109d 00000003 769cf34c 00000000 ntdll!KiFastSystemCallRet

    061cff88 76928415 00000003 769cf34c 00000000 kernel32!WaitForMultipleObjects+0x18

    061cffb8 77e6608b 00000000 00000000 00000000 userenv!GetProfilesDirectoryW+0x1de

    061cffec 00000000 769283b9 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     20  Id: 558.7c4 Suspend: 1 Teb: 7ffa3000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    064efc7c 79e77fd1 0000021c 00009c40 00000000 ntdll!KiFastSystemCallRet

    064efcc0 79e77f9a 0000021c 00009c40 00000000 mscorwks!DllUnregisterServerInternal+0x47b1

    064efd10 79e77f50 00009c40 00000000 00000000 mscorwks!DllUnregisterServerInternal+0x477a

    064efda0 7a1121c3 000bc898 00009c40 00000000 mscorwks!DllUnregisterServerInternal+0x4730

    064efe14 79ecb00b 00000000 f72e1b10 809809f0 mscorwks!TranslateSecurityAttributes+0x277e6

    064effb8 77e6608b 059c4218 00000000 00000000 mscorwks!CreateApplicationContext+0xc4a7

    064effec 00000000 79ecafc5 059c4218 00000000 kernel32!GetModuleFileNameA+0xeb

     21  Id: 558.9c0 Suspend: 1 Teb: 7ffa2000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0710fd28 79f2f30a 00000228 0710fd6c 0710fd68 ntdll!KiFastSystemCallRet

    0710fd94 79ecb00b 00000000 00000000 00000000 mscorwks!CreateAssemblyCache+0x2125c

    00000000 00000000 00000000 00000000 00000000 mscorwks!CreateApplicationContext+0xc4a7

     22  Id: 558.2d8 Suspend: 1 Teb: 7ffa0000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0741ff34 77694ff1 0741ff58 00000000 00000000 ntdll!KiFastSystemCallRet

    0741ff74 776cf35b 00007530 77e6ba50 059ee928 ole32!GetHGlobalFromStream+0x13c3

    0741ff90 776cf2a3 0741ffb8 776b2307 77790438 ole32!OleDoAutoConvert+0x10ee

    0741ff98 776b2307 77790438 00000000 059ee928 ole32!OleDoAutoConvert+0x1036

    0741ffb8 77e6608b 059ee928 00000000 00000000 ole32!IsValidInterface+0x4db

    0741ffec 00000000 776b2354 059ee928 00000000 kernel32!GetModuleFileNameA+0xeb

     23  Id: 558.b34 Suspend: 1 Teb: 7ff3f000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    09bbfd74 77e6ba42 000009cc 00002710 00000000 ntdll!KiFastSystemCallRet

    09bbfd88 75bb22b9 000009cc 00002710 00000000 kernel32!WaitForSingleObject+0x12

    09bbffb8 77e6608b 059e3d10 00000000 00000000 comsvcs!DispManGetContext+0x24e

    09bbffec 00000000 75bb21f1 059e3d10 00000000 kernel32!GetModuleFileNameA+0xeb

     24  Id: 558.390 Suspend: 1 Teb: 7ffa5000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    0faefef4 7739cd08 00000002 0faeff1c 00000000 ntdll!KiFastSystemCallRet

    0faeff50 7738e381 00000001 0faeffb0 ffffffff user32!PeekMessageW+0x244

    0faeff6c 4dda6ad4 00000001 0faeffb0 00000000 user32!MsgWaitForMultipleObjects+0x1f

    0faeffb8 77e6608b 00000000 00000000 00000000 GdiPlus!GdipCreateSolidFill+0x1fea

    0faeffec 00000000 4dda6a7b 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     25  Id: 558.e6c Suspend: 1 Teb: 7ff3a000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1056e198 7c8302e7 05570748 1056e3cc 7c82fadf ntdll!ExpInterlockedPopEntrySListEnd+0x5

    1056e1a4 7c82fadf 05570748 12ffc218 00000014 ntdll!RtlInitUnicodeStringEx+0xa0

    1056e3cc 7c3416b3 05570000 00000000 00000014 ntdll!RtlAllocateHeap+0xe2

    1056e40c 7c3416db 00000014 7c360947 00000014 msvcr71!_crtLCMapStringA+0x305

    1056e44c 1200789d 00000014 0ebb0b68 1202d96c msvcr71!_crtLCMapStringA+0x32d

    1056e474 12038153 00000001 215b9958 12ffca20 xerces_c_2_6!xercesc_2_6::XMemory::operator new+0x14

    1056e5ec 12033a59 0ed76a58 00000003 12ffca20 xerces_c_2_6!xercesc_2_6::IGXMLScanner::buildAttList+0x4f0

    1056e68c 12034595 1056e6b3 14f968f4 14f96878 xerces_c_2_6!xercesc_2_6::IGXMLScanner::scanStartTagNS+0xa9d

    1056e6c4 12034800 0f626520 14f96878 00000000 xerces_c_2_6!xercesc_2_6::IGXMLScanner::scanContent+0xbf

    1056e6f0 12045dfb 0f626520 14f96878 0ea936b0 xerces_c_2_6!xercesc_2_6::IGXMLScanner::scanDocument+0x5b

    1056e76c 12045f01 0f626520 13539238 0eadbef8 xerces_c_2_6!xercesc_2_6::XMLScanner::scanDocument+0x143

    1056e794 1205192b 0f6264d0 13539238 0000003e xerces_c_2_6!xercesc_2_6::XMLScanner::scanDocument+0x36

    1056e7d8 05c0fe73 0f6264d0 1056ebbc 13539238 xerces_c_2_6!xercesc_2_6::AbstractDOMParser::parse+0x53

    1056eb5c 05c1726d 1056eb98 01ce330e 1cfa8d70 GeoCalc!GeoCalc::DB::CDataSource::LoadDOM+0x163

    1056eba8 79f98584 1e3b6415 00000010 b59aaf96 GeoCalc!GeoCalc::DB::CDataSource::LoadFile+0x1d

    1056ec34 1e3b51d8 00000000 1056ecb8 1e3b511c mscorwks!DllCanUnloadNowInternal+0x4cc8

    1056ec60 1e3b511c 155cec40 1cfa8670 1c91b07c 0x1e3b51d8

    1056ecb8 1e3b278c 032ddc40 1c918904 1c918900 0x1e3b511c

    1056ed6c 1930c442 155cec40 00000000 1c88e2d0 0x1e3b278c

    1056edb4 1930c248 1556d8c0 155cec40 00000000 0x1930c442

     26  Id: 558.78c Suspend: 1 Teb: 7ff36000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    197efba8 79f2f30a 00000228 197efbec 197efbe8 ntdll!KiFastSystemCallRet

    197efc14 79ecb00b 00000000 00000000 197efcb8 mscorwks!CreateAssemblyCache+0x2125c

    00000000 00000000 00000000 00000000 00000000 mscorwks!CreateApplicationContext+0xc4a7

     27  Id: 558.d0 Suspend: 1 Teb: 7ff38000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1954ff84 77c5778f 1954ffac 77c5f7dd 000a56e8 ntdll!KiFastSystemCallRet

    1954ff8c 77c5f7dd 000a56e8 00000000 00000000 rpcrt4!NdrOleFree+0x3c5

    1954ffac 77c5de88 0008fdc0 1954ffec 77e6608b rpcrt4!I_RpcTransGetThreadEvent+0x188

    1954ffb8 77e6608b 00162c38 00000000 00000000 rpcrt4!I_RpcLogEvent+0xe92

    1954ffec 00000000 77c5de6d 00162c38 00000000 kernel32!GetModuleFileNameA+0xeb

     28  Id: 558.f38 Suspend: 1 Teb: 7ff3d000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1b6eec94 01ce7d2f 1c9bae8c 00000000 00000000 ntdll!KiFastSystemCallRet

    1b6eecbc 1d870428 1c9bae54 1c9bae88 00000000 0x1ce7d2f

    1b6eecdc 1d870428 00000000 00000000 1b6eed2c vjslib_ni+0x20428

    1b6eecf8 1d97a03e 00000000 00000000 1c9bae54 vjslib_ni+0x20428

    1b6eed2c 1d8ea1d0 01ce7022 1b6ef19c b59aaf96 vjslib_ni+0x12a03e

    1b6eed48 793d7a7b 00000000 1c9b8a7c 1b6eedac vjslib_ni+0x9a1d0

    1b6eed80 79e88f63 00000000 00000000 1b6eee10 mscorlib_ni+0x317a7b

    1b6eed90 79e88ee4 1b6eee60 00000000 1b6eee30 mscorwks!LogHelp_TerminateOnAssert+0x2f13

    1b6eee10 79e88e31 1b6eee60 00000000 1b6eee30 mscorwks!LogHelp_TerminateOnAssert+0x2e94

    1b6eef50 79e88d19 796902ac 1b6ef094 1b6eef9c mscorwks!LogHelp_TerminateOnAssert+0x2de1

    1b6ef044 79e88805 79e816f7 1b6ef094 79e88888 mscorwks!LogHelp_TerminateOnAssert+0x2cc9

    1b6ef048 79e816f7 1b6ef094 79e88888 1b6ef094 mscorwks!LogHelp_TerminateOnAssert+0x27b5

    1b6ef050 79e88888 1b6ef094 79e88a0d 00000004 mscorwks!InstallCustomModule+0x2187

    1b6ef148 79ef7fde 1b6ef1dc aeff2a6f 1b85100c mscorwks!LogHelp_TerminateOnAssert+0x2838

    1b6ef190 79ef7f1e b59aaf96 79e72048 1b6ef454 mscorwks!IEE+0x20a92

    1b6ef1f8 793684fb 1b6ef19c 1c9b8a7c 02932c28 mscorwks!IEE+0x209d2

    1b6ef210 793683ee 153629bc 1b6ef240 1b6ef26c mscorlib_ni+0x2a84fb

    1b6ef228 793d7b5c 1c9b8a7c 00000000 108e8770 mscorlib_ni+0x2a83ee

    1b6ef240 79e88f63 00000000 00000000 1b6ef2d0 mscorlib_ni+0x317b5c

    1b6ef250 79e88ee4 1b6ef320 00000000 1b6ef2f0 mscorwks!LogHelp_TerminateOnAssert+0x2f13

     29  Id: 558.904 Suspend: 1 Teb: 7ff37000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1b79fb14 71b23a52 000014f0 000014f4 00000000 ntdll!KiFastSystemCallRet

    1b79fc04 71c0470c 00000001 1b79fe84 1b79fc7c mswsock+0x3a52

    1b79fc54 77215d7a 00000001 1b79fe84 1b79fc7c ws2_32!select+0xa1

    1b79ffb0 7721d925 1b79ffec 77e6608b 10ac89d0 wininet!InternetCanonicalizeUrlW+0x191

    1b79ffb8 77e6608b 10ac89d0 00000000 00000000 wininet!UnlockUrlCacheEntryFileA+0x31c

    1b79ffec 00000000 7721d918 10ac89d0 00000000 kernel32!GetModuleFileNameA+0xeb

     30  Id: 558.f48 Suspend: 1 Teb: 7ff35000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1b7dffb8 77e6608b 71b268c0 00000000 00000000 ntdll!KiFastSystemCallRet

    1b7dffec 00000000 71b23e4b 10adebc8 00000000 kernel32!GetModuleFileNameA+0xeb

     31  Id: 558.de8 Suspend: 1 Teb: 7ff34000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e1affb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e1affec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     32  Id: 558.b60 Suspend: 1 Teb: 7ffa1000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    192aff7c 77e424c1 0000ea60 00000000 192affb8 ntdll!KiFastSystemCallRet

    192aff8c 776b22a0 0000ea60 10adb0d8 776b2307 kernel32!Sleep+0xf

    192affb8 77e6608b 10adb0d8 00000000 00000000 ole32!IsValidInterface+0x474

    192affec 00000000 776b2354 10adb0d8 00000000 kernel32!GetModuleFileNameA+0xeb

     33  Id: 558.348 Suspend: 1 Teb: 7ffde000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e20ff90 761ba048 00000001 10b88190 00000000 ntdll!KiFastSystemCallRet

    1e20ffb8 77e6608b 00000001 00000000 00000000 crypt32!RegSetValueExU+0x2b9

    1e20ffec 00000000 761ba01d 10b88188 00000000 kernel32!GetModuleFileNameA+0xeb

     34  Id: 558.d24 Suspend: 1 Teb: 7ffd9000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e42ffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e42ffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     35  Id: 558.fc4 Suspend: 1 Teb: 7ff3e000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e46ffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e46ffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     36  Id: 558.fcc Suspend: 1 Teb: 7ff3c000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e4affb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e4affec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     37  Id: 558.470 Suspend: 1 Teb: 7ff3b000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e4effb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e4effec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     38  Id: 558.c64 Suspend: 1 Teb: 7ff39000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e52ffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e52ffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     39  Id: 558.12c Suspend: 1 Teb: 7ff33000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    1e56ffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    1e56ffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

     40  Id: 558.27c Suspend: 1 Teb: 7ff32000 Unfrozen

    ChildEBP RetAddr  Args to Child              

    WARNING: Stack unwind information not available. Following frames may be wrong.

    23b4ffb8 77e6608b 00000000 00000000 00000000 ntdll!KiFastSystemCallRet

    23b4ffec 00000000 7c83ad38 00000000 00000000 kernel32!GetModuleFileNameA+0xeb

    0:014> ~* e !clrstack

    OS Thread Id: 0x55c (0)

    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: 0x5ac (1)

    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: 0x5c8 (2)

    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: 0x5dc (3)

    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: 0x5e0 (4)

    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: 0x5e4 (5)

    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: 0x5e8 (6)

    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: 0x5f0 (7)

    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: 0x5f4 (8)

    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: 0x5fc (9)

    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: 0x604 (10)

    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: 0x554 (11)

    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: 0x1ec (12)

    Failed to start stack walk: 80004005

    OS Thread Id: 0x208 (13)

    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: 0x620 (14)

    ESP       EIP    

    019dfa8c 77e55e02 [GCFrame: 019dfa8c]

    019dfaf4 77e55e02 [GCFrame: 019dfaf4]

    OS Thread Id: 0x624 (15)

    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: 0x630 (16)

    Failed to start stack walk: 80004005

    OS Thread Id: 0x880 (17)

    Failed to start stack walk: 80004005

    OS Thread Id: 0x884 (18)

    Failed to start stack walk: 80004005

    OS Thread Id: 0xce0 (19)

    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: 0x7c4 (20)

    Failed to start stack walk: 80004005

    OS Thread Id: 0x9c0 (21)

    Failed to start stack walk: 80004005

    OS Thread Id: 0x2d8 (22)

    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: 0xb34 (23)

    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: 0x390 (24)

    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: 0xe6c (25)

    ESP       EIP    

    1056eb98 7c8224b9 [NDirectMethodFrameStandalone: 1056eb98] <Module>.GeoCalc.DB.CDataSource.LoadFile(GeoCalc.DB.CDataSource*, UInt16*)

    1056eba8 1e3b645c GeoCalcNET.DataSourceComponent.LoadFile(System.String)

    1056ec3c 1e3b51d8 BMGCoordinateTransformerProvider.BMGCoordinateTransformer.LoadDataSource(System.String, LoggingFramework.ILog)

    1056ec6c 1e3b511c BMGCoordinateTransformerProvider.BMGCoordinateTransformer.Initialize(CoreFramework.IPropertySet, System.String, LoggingFramework.ILog)

    1056ec80 1e3b2d58 MappingFramework.Utils.MFUtils.LoadProjectionSystem(System.String, System.Xml.XmlNode, XMLFramework.DocParser, LoggingFramework.ILog, Boolean, Boolean, MappingFramework.Projections.CoordSysLookup ByRef, MappingFramework.Projections.DatumTransformationLookup ByRef, MappingFramework.Projections.ICoordinateTransformer ByRef)

    1056ecdc 1e3b278c OnPointFramework.Application.Component.MapComponent.LoadProjectionSystem(OnPointFramework.Application.AppConfiguration, LicenseUtils.LicenseContext, Boolean)

    105

  45. Yoda's Blog says:

    Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0

  46. Very instructive post, thank you!

    I have a crash to Manche’s (don’t worry, I won’t post a comment that size here :)). It’s also related to a third-party component, developed in J#. The presence of com.ms.vjsharp.windowing.win32.Win32Toolkit.run() in the call stack is the part that scares me.

    There might be some problem related to VJ# exception handling. Looks like it’s trying to report the exception to a win32 window, or something like that.

    I’m debugging the crash. In Visual Studio, it shows, on the call stack of the offending thread:

    [Managed to Native Transition]

    > vjslib.dll!com.ms.vjsharp.windowing.win32.Win32Toolkit.run() + 0x52 bytes

    vjslib.dll!java.lang.Thread.run() + 0x10 bytes

    [Native to Managed Transition]

    [Managed to Native Transition]

    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x3b bytes

    mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x43 bytes

    [Native to Managed Transition]

    [Managed to Native Transition]

    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0xa7 bytes

    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x92 bytes

    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x40 bytes

    [Appdomain Transition]

  47. roy ashbrook says:

    These are the articles (in no particular order) that I felt best showed a thorough use of the windbg

  48. Brad says:

    I cannot use a debugger to troubleshoot the issue in this case. The HttpModule you referred to works for a ASP.NET app.

  49. Neil says:

    Hi Tess,

    Was hoping if you can give us some direction to look towards based on this  output we got from windbg.

    This dump file has an exception of interest stored in it.

    The stored exception information can be accessed via .ecxr.

    (ec.117c): CLR exception – code e0434f4d (first/second chance not available)

    eax=1bd7f64c ebx=1b1352d8 ecx=00000000 edx=00000024 esi=1bd7f6d8 edi=e0434f4d

    eip=77e4bee7 esp=1bd7f648 ebp=1bd7f69c iopl=0         nv up ei pl nz na po nc

    cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202

    kernel32!RaiseException+0x53:

    77e4bee7 5e              pop     esi

    0:033> !anlyze -v

    No export anlyze found

    0:033> !analyze -v

    *******************************************************************************

    *                                                                             *

    *                        Exception Analysis                                   *

    *                                                                             *

    *******************************************************************************

    *** WARNING: Unable to verify checksum for System.Web.ni.dll

    *** WARNING: Unable to verify checksum for mscorlib.ni.dll

    *** WARNING: Unable to verify checksum for System.ni.dll

    FAULTING_IP:

    kernel32!RaiseException+53

    77e4bee7 5e              pop     esi

    EXCEPTION_RECORD:  ffffffff — (.exr 0xffffffffffffffff)

    ExceptionAddress: 77e4bee7 (kernel32!RaiseException+0x00000053)

      ExceptionCode: e0434f4d (CLR exception)

     ExceptionFlags: 00000001

    NumberParameters: 1

      Parameter[0]: 80131509

    DEFAULT_BUCKET_ID:  CLR_EXCEPTION

    PROCESS_NAME:  w3wp.exe

    ERROR_CODE: (NTSTATUS) 0xe0434f4d – <Unable to get error code text>

    NTGLOBALFLAG:  0

    APPLICATION_VERIFIER_FLAGS:  0

    MANAGED_STACK:

    ChildEBP RetAddr  Caller,Callee

    EXCEPTION_OBJECT: !pe 28098d0

    Exception object: 028098d0

    Exception type: System.Net.WebException

    Message: The operation has timed out

    InnerException: <none>

    StackTrace (generated):

    <none>

    StackTraceString: <none>

    HResult: 80131509

    MANAGED_OBJECT: !dumpobj 280c0d00280aba4

    Name: System.String

    MethodTable: 790f9244

    EEClass: 790f91a4

    Size: 72(0x48) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    String: The operation has timed out

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    790fdb60  4000096        4         System.Int32  0 instance       28 m_arrayLength

    790fdb60  4000097        8         System.Int32  0 instance       27 m_stringLength

    790fad38  4000098        c          System.Char  0 instance       54 m_firstChar

    790f9244  4000099       10        System.String  0   shared   static Empty

       >> Domain:Value  000dfa00:790d57b4 00117138:790d57b4 <<

    79122994  400009a       14        System.Char[]  0   shared   static WhitespaceChars

       >> Domain:Value  000dfa00:027203f0 00117138:027244a4 <<

    EXCEPTION_MESSAGE:  The operation has timed out

    LAST_CONTROL_TRANSFER:  from 79f55b05 to 77e4bee7

    STACK_TEXT:  

    1bd7f69c 79f55b05 e0434f4d 00000001 00000001 kernel32!RaiseException+0x53

    1bd7f6fc 7a056a79 028098d0 00000000 00000000 mscorwks!RaiseTheExceptionInternalOnly+0x226

    1bd7f710 7a056af2 028098d0 00000000 1bd7f828 mscorwks!RaiseTheException+0x4d

    1bd7f738 7a056b30 00000000 1b1352d8 db9b9274 mscorwks!RaiseTheException+0xbf

    1bd7f764 7a056b41 028098d0 00000000 7a0e38fa mscorwks!RealCOMPlusThrow+0x38

    1bd7f770 7a0e38fa 028098d0 1e66c88c 7a36f194 mscorwks!RealCOMPlusThrow+0xb

    1bd7f8a0 7a0e4b97 00000000 1bd7f8d8 1bd7f948 mscorwks!Thread::RaiseCrossContextException+0x3ac

    1bd7f954 7a0e5a07 00000002 79f5e3aa 1bd7fa48 mscorwks!Thread::DoADCallBack+0x26c

    1bd7f96c 79ed89ca 1bd7fa48 1bd7f9f4 79f55262 mscorwks!Thread::UserResumeThread+0xe1

    1bd7fa00 79ed88f1 1bd7fa48 1e66ca84 00000001 mscorwks!Thread::DoADCallBack+0x355

    1bd7fa3c 7a0e4d96 1bd7fa48 00000002 00000000 mscorwks!Thread::DoADCallBack+0x541

    1bd7fa64 7a0e4dad 00000002 7a078575 1bd7fad0 mscorwks!Thread::DoADCallBack+0x575

    1bd7fa78 7a07a99e 00000002 7a078575 1bd7fad0 mscorwks!ManagedThreadBase::KickOff+0x13

    1bd7fb14 79ed8e36 1b174e60 1bd7fb50 00000000 mscorwks!ThreadNative::KickOffThread+0x230

    1bd7ffb8 77e64829 1b16d2a0 00000000 00000000 mscorwks!Thread::intermediateThreadProc+0x49

    1bd7ffec 00000000 79ed8df0 1b16d2a0 00000000 kernel32!BaseThreadStart+0x34

    FOLLOWUP_IP:

    mscorwks!RaiseTheExceptionInternalOnly+226

    79f55b05 c745fcfeffffff  mov     dword ptr [ebp-4],0FFFFFFFEh

    SYMBOL_STACK_INDEX:  1

    FOLLOWUP_NAME:  MachineOwner

    MODULE_NAME: mscorwks

    IMAGE_NAME:  mscorwks.dll

    DEBUG_FLR_IMAGE_TIMESTAMP:  461f2e2a

    FAULTING_THREAD:  0000117c

    PRIMARY_PROBLEM_CLASS:  CLR_EXCEPTION

    BUGCHECK_STR:  APPLICATION_FAULT_CLR_EXCEPTION

    SYMBOL_NAME:  mscorwks!RaiseTheExceptionInternalOnly+226

    STACK_COMMAND:  ~33s; .ecxr ; kb

    FAILURE_BUCKET_ID:  APPLICATION_FAULT_CLR_EXCEPTION_System.Net.WebException_mscorwks!RaiseTheExceptionInternalOnly+226

    BUCKET_ID:  APPLICATION_FAULT_CLR_EXCEPTION_System.Net.WebException_mscorwks!RaiseTheExceptionInternalOnly+226

    Followup: MachineOwner

    ———

    Thanks,

    Neil

  50. Tess says:

    I would start of with !clrstack on the current thread (the one that throws the exception) and ~* e !clrstack to see what all threads are doing to get an idea of why its timing out.

  51. Ben Wagenaar says:

    Hi Tess,

    Great article! Just one thing – you mention the following when creating Microsoft’s UnhandledExceptionModule.dll from their KB article:

    "You don’t actually need to strong name it and add it to the GAC, however if you plan it in multiple applications you should to avoid for the dll being loaded multiple times."

    I’ve produced this DLL and using the instructions on Microsoft’s article, it installs correctly in the GAC via my development PC, but in our UAT and Production systems here, we don’t have these tools to complete it. I can add it successfully to the GAC for .NET 2.0 components, but the web.config reference throws an error saying that the "codebase cannot be found".

    My question is, how would I install this DLL into my web app to enable unhandled exceptions to be caught?

    Thanks in advance,

    Ben

  52. Tess says:

    Hi Ben,

    Sounds like it is not matching up the right version/key in the GAC.  Is that the exact message you get (i.e. "codebase cannot be found")?  

    You might want to read through this regarding how the probing is done as it might help you figure out why it fails.

    http://en.csharp-online.net/.NET_CLR_Components%E2%80%94Resolving_Names_to_Locations

    On a separate note, although it is best practice to store it in the GAC and i wouldn’t recommend creating copies in the bin directory for all dlls, this dll is extremely small so removing the strong name and storing this one in the GAC wont really cause any noticeable memory changes, assuming that you dont have hundreds of different applications.

  53. Ben Wagenaar says:

    Thanks Tess – you’re right, the "codebase cannot be found" message is the one I see.

    How could I add this to the GAC (without a strong name) and reference it in my web.config file, inside the httpModules tag? This entry appears to require a strong name and this is where my error message originates from.

    Apologies for all the questions – although I’ve been coding in .NET for a while, I’ve had little experience in deploying these apps.

    Thanks again,

    Ben

  54. Tess says:

    To my knowledge you cant add an assembly that is not strongnamed to the GAC so if it is not strong named it would have to reside in the bin.

    If someone knows differently, please correct me:)

  55. This has been a busy month for blogging for me, I’m up to a whopping 8 posts this month including this

  56. enrique.prados@a-e.es says:

    Hi misters,

    is it possible use AppDomain.Currentdomain. UnhandledException event en ASP.NET 2.0 ??

    I have this code:

    protected override void OnInit(EventArgs e)

           {

               base.OnInit(e);

               PantallaControlIULogging.TrazarDebug("Principal. OnInit.");

               PantallaControlIULogging.TrazarWarning("Principal. CurrentDomain_UnhandledException. ");

               AppDomain.CurrentDomain.UnhandledException -= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

               AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

           }

    and

    protected void Page_Load(object sender, EventArgs e)

           {

               PantallaControlIULogging.TrazarWarning("Principal. CurrentDomain_UnhandledException. ");

               AppDomain.CurrentDomain.UnhandledException -= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

               AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

    I don’t get fire that event when throw an error

           protected void b2click(object sender, EventArgs e)

           {

                   // Forzar error

                   throw new

    Excepciones.BloqueoTareaExcepcion("ERROR BloqueoTareaExcepcion!!!");

    I want to get the error and show it using javascript (alert).

    By other reasons, I cannot access to global.asax and I cannot use HttpApplication_Error event.

    Any help will be appreciated, and I’ll be very grateful. Thanks in advance.

    Greetings, regards.

  57. Lee says:

    Thank you, thank you, thank you, thank you. This helped me solve a major roadblock at work.

  58. Daniel says:

    wow. finally an easy to understand walkthrough on  debugging! What I like is that it’s not just the fix but the process of determining what caused the error in the first place and what all the little bits mean.

    Thank you very much!

  59. mattc says:

    hey Tess

    I have this problem so am looking to implement your handler..

    I built it OK..

    I actually moved the dll to a development web server and registered it in the GAC etc fine.

    Except when I run the web app I get an error.

    "The given assembly name or codebase was invalid. "

    This is what I have in my web.config:

    <httpModules>

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

         <add name="UnhandledExceptionMonitor"  type="WebMonitor.UnhandledExceptionModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b30ebd417a518934, processorArchitecture=MSIL"/>

       </httpModules>

    any help greatly appreciated, I’m sure it will help once I get it working!

    Matt

  60. Tess says:

    It looks right assuming that the strong name is correct, except for that the name should probably be UnhandledExceptionModule rather than UnhandledExceptionMonitor unless you changed the name, in which case it should probably also be changed in the type

  61. matt says:

    Hi Tess.

    hmm was getting tired! Changed that but still doesn’t work. I will have another look at it.

    assuming once I’ve compiled the dll I can move it between machines, thats not the problem..?

    Thanks, Matt

  62. Andras Vass says:

    Thank you, this article was very useful.

    I had the same issues carrying out the KB instructions on a  production system as Ben Wagenaar mentioned in a previous comment.

    More about this on:

    http://andrasvass.blogspot.com/2008/05/aspnet-20-unhandled-exceptions-aka.html

    I ended up creating installers for the module – you can find them on Codeplex:

    https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=unhandledexception

    Perhaps it may help Matt solve his deployment problems (if he hasn’t already…)

  63. TSW says:

    Matt, I had the same problem as you. The issue (aside from what Tess mentioned), you’re not forming the strong name correctly. You have:

    type="WebMonitor.UnhandledExceptionModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b30ebd417a518934, processorArchitecture=MSIL"

    What you want is this:

    type="WebMonitor.UnhandledExceptionModule, UnhandledExceptionModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b30ebd417a518934, processorArchitecture=MSIL"

    Notice the extra "UnhandledExceptionModule, " after the initial class name…

    Also, Tess, up above (http://blogs.msdn.com/tess/archive/2006/04/27/asp-net-2-0-crash-case-study-unhandled-exceptions.aspx#1081135) Howard brings up a potentially good point. Is he right?

  64. Deniz says:

    I received this error while coding a shared office Add-In. I had put some code in the Finalize-Method. Moving the code to the applications "close" event helped.

    Lesson learned: Don’t mess around with finalize if you dont have to!

  65. Abhishek says:

    Just one word to describe my thoughts on this article…Enlightened 🙂

  66. JanIvan Qian says:

    Hi Tess, it’s really a good post for debuging crash. The two methods are both practical. Thanks very much for your great tech and expirence.  Thanks for sharing! I’m your fan now 🙂

    Keep moving!

  67. I get this error only when running the application through Task Scheduler. If I start the application manually, it runs fine. WTF???

  68. Tess says:

    could be a lot of things, like running in a different user context etc.

    I would just get a dump and see what the exception is if you dont get that already from the eventlog entry, and from that try to figure out why it happens.

    Something is obviously different when you run it in task scheduler vs. manually

  69. I know there were already lots of discussions about this topic, but as a .NET developer and support engineer,

  70. Sergey P. says:

    Thanks! Your article helped me a lot!

  71. I know there were already lots of discussions about this topic, but as a .NET developer and support engineer,

  72. Red Dog says:

    OK, got the error message on a laptop and I’ve read all of the above. My question(s) is… What does any of it mean? Can’t I just re-install summink to get rid of the error?

  73. Acby says:

    Hi Tess,

    Wow what a great article, one of the best I have read, and just what I needed.

    I have a W3wp web service that has recently started aborting for no apparent reason. Following you excellent tutorials I used WinDbg to try to ascertain the problem.

    Unfortunately I seem to have hit a brick wall in that when I try to trace back the exception I get stuck in the framework code and am unable to see how to trace back to the root cause. I was was wondering if you could give me any quick hints as to how next to progress in tracing back the real source of this exception.

    Many thanks for an excellent series.

    Acby

    0:009> !threads

    ThreadCount: 15

    UnstartedThread: 0

    BackgroundThread: 13

    PendingThread: 0

    DeadThread: 1

    Hosted Runtime: no

                                         PreEmptive   GC Alloc           Lock

          ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception

      7    1  30c 0169c3f0      8220 Enabled  00000000:00000000 01697520     0 Ukn

     16    2 21bc 016aa9d8      b220 Enabled  00000000:00000000 01697520     0 MTA (Finalizer)

     18    3  cc8 1a4203a0    80a220 Enabled  00000000:00000000 01697520     0 MTA (Threadpool Completion Port)

     19    4 1f5c 1a420cb0      1220 Enabled  00000000:00000000 01697520     0 Ukn

     20    5 1484 1a465fc8   180b220 Enabled  407862f8:4078763c 1a421200     0 MTA (Threadpool Worker)

     21    6  d38 1a466398   180b220 Enabled  20409550:20409d58 1a421200     0 MTA (Threadpool Worker)

     22    7  a54 1a466768   180b220 Enabled  387eaa20:387ec59c 1a421200     0 MTA (Threadpool Worker)

     23    8 20fc 1a466b38   180b220 Enabled  20417da0:20417db8 1a421200     0 MTA (Threadpool Worker)

      9    9 1270 1a466f08   880a220 Enabled  3cab03ac:3cab15a8 01697520     0 MTA (Threadpool Completion Port) System.InvalidOperationException (3caacbe4)

    XXXX    a    0 1a4b5d98      9820 Enabled  00000000:00000000 01697520     0 MTA

      3    c 1cb4 1a53fe80       220 Enabled  3c920744:3c922704 01697520     0 Ukn

     25    b 1064 4a8faac0   200b020 Enabled  387a90fc:387aa520 1a421200     0 MTA

     27    d 1f14 1b914a80   200b220 Enabled  20403f98:20405d58 1a421200     1 MTA

     28    e 1a84 1b7e00a8    80a220 Enabled  00000000:00000000 01697520     0 MTA (Threadpool Completion Port)

     30    f 2324 1a54c8e8   180b220 Enabled  40850890:40850a68 01697520     0 MTA (Threadpool Worker)

    0:009> !do 1a466f08

    <Note: this object has an invalid CLASS field>

    Invalid object

    0:009> !do 3caacbe4

    Name: System.InvalidOperationException

    MethodTable: 72068c50

    EEClass: 71e34b64

    Size: 72(0x48) bytes

    (C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    72080b54  40000b5        4        System.String  0 instance 3caacc3c _className

    7207ffc8  40000b6        8 …ection.MethodBase  0 instance 00000000 _exceptionMethod

    72080b54  40000b7        c        System.String  0 instance 3caadacc _exceptionMethodString

    72080b54  40000b8       10        System.String  0 instance 3caacd80 _message

    7207a4b0  40000b9       14 …tions.IDictionary  0 instance 3caae330 _data

    72080ce8  40000ba       18     System.Exception  0 instance 3caae848 _innerException

    72080b54  40000bb       1c        System.String  0 instance 00000000 _helpURL

    72080770  40000bc       20        System.Object  0 instance 00000000 _stackTrace

    72080b54  40000bd       24        System.String  0 instance 00000000 _stackTraceString

    72080b54  40000be       28        System.String  0 instance 3caaf9b0 _remoteStackTraceString

    72082da0  40000bf       34         System.Int32  1 instance        0 _remoteStackIndex

    72080770  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

    72082da0  40000c1       38         System.Int32  1 instance -2146233079 _HResult

    72080b54  40000c2       30        System.String  0 instance 3caade38 _source

    7208341c  40000c3       3c        System.IntPtr  1 instance        0 _xptrs

    72082da0  40000c4       40         System.Int32  1 instance        0 _xcode

    0:009> !do 3caaf9b0

    Name: System.String

    MethodTable: 72080b54

    EEClass: 71e3d65c

    Size: 2554(0x9fa) bytes

    (C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    String:    at System.Web.Services.Protocols.WebClientProtocol.ProcessAsyncException(WebClientAsyncResult client, Exception e, String method)

      at System.Web.Services.Protocols.WebClientProtocol.ReadResponseAsyncCallback(IAsyncResult asyncResult)

      at System.Net.LazyAsyncResult.Complete(IntPtr userToken)

      at System.Net.ContextAwareResult.CompleteCallback(Object state)

      at System.Threading.ExecutionContext.runTryCode(Object userData)

      at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

      at System.Net.ContextAwareResult.Complete(IntPtr userToken)

      at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)

      at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

      at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    72082da0  4000096        4         System.Int32  1 instance     1269 m_arrayLength

    72082da0  4000097        8         System.Int32  1 instance     1268 m_stringLength

    72081834  4000098        c          System.Char  1 instance       20 m_firstChar

    72080b54  4000099       10        System.String  0   shared   static Empty

       >> Domain:Value  01697520:01d801d0 1a421200:01d801d0 <<

    72081784  400009a       14        System.Char[]  0   shared   static WhitespaceChars

       >> Domain:Value  01697520:01d80728 1a421200:01d8548c <<

    0:009> !do 3caae848

    Name: System.NullReferenceException

    MethodTable: 72070128

    EEClass: 71e9e118

    Size: 72(0x48) bytes

    (C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    72080b54  40000b5        4        System.String  0 instance 3caae890 _className

    7207ffc8  40000b6        8 …ection.MethodBase  0 instance 00000000 _exceptionMethod

    72080b54  40000b7        c        System.String  0 instance 3caaf630 _exceptionMethodString

    72080b54  40000b8       10        System.String  0 instance 3caae91c _message

    7207a4b0  40000b9       14 …tions.IDictionary  0 instance 3caaf938 _data

    72080ce8  40000ba       18     System.Exception  0 instance 00000000 _innerException

    72080b54  40000bb       1c        System.String  0 instance 00000000 _helpURL

    72080770  40000bc       20        System.Object  0 instance 00000000 _stackTrace

    72080b54  40000bd       24        System.String  0 instance 00000000 _stackTraceString

    72080b54  40000be       28        System.String  0 instance 3caaeb30 _remoteStackTraceString

    72082da0  40000bf       34         System.Int32  1 instance        0 _remoteStackIndex

    72080770  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

    72082da0  40000c1       38         System.Int32  1 instance -2147467261 _HResult

    72080b54  40000c2       30        System.String  0 instance 3caaf8a4 _source

    7208341c  40000c3       3c        System.IntPtr  1 instance        0 _xptrs

    72082da0  40000c4       40         System.Int32  1 instance        0 _xcode

    0:009> !do 3caaeb30

    Name: System.String

    MethodTable: 72080b54

    EEClass: 71e3d65c

    Size: 2720(0xaa0) bytes

    (C:WindowsassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    String:    at System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext)

      at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)

      at System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state)

      at System.Web.AspNetSynchronizationContext.CallCallback(SendOrPostCallback callback, Object state)

      at System.Web.AspNetSynchronizationContext.Post(SendOrPostCallback callback, Object state)

      at System.ComponentModel.AsyncOperation.Post(SendOrPostCallback d, Object arg)

      at System.ComponentModel.AsyncOperation.PostOperationCompleted(SendOrPostCallback d, Object arg)

      at System.Web.Services.Protocols.HttpWebClientProtocol.OperationCompleted(Object userState, Object[] parameters, Exception e, Boolean canceled)

      at System.Web.Services.Protocols.SoapHttpClientProtocol.InvokeAsyncCallback(IAsyncResult result)

      at System.Web.Services.Protocols.WebClientAsyncResult.Complete()

      at System.Web.Services.Protocols.WebClientProtocol.ProcessAsyncResponseStreamResult(WebClientAsyncResult client, IAsyncResult asyncResult)

      at System.Web.Services.Protocols.WebClientProtocol.ReadAsyncResponseStream(WebClientAsyncResult client)

      at System.Web.Services.Protocols.WebClientProtocol.ReadResponseAsyncCallback(IAsyncResult asyncResult)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    72082da0  4000096        4         System.Int32  1 instance     1352 m_arrayLength

    72082da0  4000097        8         System.Int32  1 instance     1351 m_stringLength

    72081834  4000098        c          System.Char  1 instance       20 m_firstChar

    72080b54  4000099       10        System.String  0   shared   static Empty

       >> Domain:Value  01697520:01d801d0 1a421200:01d801d0 <<

    72081784  400009a       14        System.Char[]  0   shared   static WhitespaceChars

       >> Domain:Value  01697520:01d80728 1a421200:01d8548c <<

  74. Sevhn says:

    Wow.  Even after 4 years this article is still helping folks like me.

    Thanks Tess!

    Another new fan. 🙂

  75. Stefan Keller says:

    Hello Tess

    trust me – i’m almost never writing any comments!

    So this here is an extraordinary exception:

    Thank you, thank you, thank you!

    For "0xe0434f4d is the exception code for CLR (.net) exceptions" for ADPlus for windbg …

    This really made my day!

  76. Dedra Houston says:

    I’m very thankful for ALL the above information, however, im VERY computer illiterate and have no clue how to get rid of the error message saying UNHANDLED EXCEPTION. It appears everytime Im on the internet and try to close a window or windows b4 shutting down system. HELP!

  77. JP says:

    Hope someone can help me out on this.  I'm new to debugging and am desperately trying to make sense of all of this.  Here's what I've got so far.  

    Running adplus on my failing w3wp process, I received the following output files:

    FULLDUMP_FirstChance_epr_Process_Shut_Down_w3wp.exe__0878_2011-03-15_17-33-35-486_047c.dmp

    along with 30 or so

    MINIDUMP_FirstChance_av_AccessViolation_w3wp.exe__0878_2011-03-15_14-16-47-051_047c.dmp  files.

    Using windg on theFullDump, i executed !threads and got

    PDB symbol for mscorwks.dll not loaded

    ThreadCount: 27

    UnstartedThread: 0

    BackgroundThread: 27

    PendingThread: 0

    DeadThread: 0

    Hosted Runtime: no

                                         PreEmptive   GC Alloc           Lock

          ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception

    XXXX    1  294 000e36a0   1808220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    2  1b8 000f6010      b220 Enabled  00000000:00000000 000e8930     0 Ukn (Finalizer)

    XXXX    3  bb0 00113610    80a220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Completion Port)

    XXXX    4  214 00116d88      1220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX    5  a88 05d40ae0   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    6  80c 05d75c38   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    7  c28 05d709d8   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    8  5c0 05e1b008   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    a  780 05e1ec70       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX    d  dd0 0bf59e78   180b220 Enabled  00000000:00000000 109b4460     1 Ukn (Threadpool Worker)

    XXXX    e  3dc 0bf4d4b0   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    f  490 0bf5a248   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX   10  3c4 0bf92900   880a220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Completion Port)

    XXXX   12  454 0bf80408       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   14  e74 0bf9b1d8   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX   16  124 0c00d270       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   17  d38 0c022738       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   18  d7c 0c080cb0       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   13  460 0c0a31c0       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX    c  de4 10989598       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   15 1700 0bf8b078   200b220 Enabled  00000000:00000000 109b4460     0 Ukn

    XXXX    9  cf4 109891c8   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX    b 179c 0c0a3590   180b220 Enabled  00000000:00000000 000e8930     0 Ukn (Threadpool Worker)

    XXXX   19 1350 0bfdca88   180b220 Disabled 00000000:00000000 109b4460     1 Ukn (Threadpool Worker) System.StackOverflowException (026c106c)

    XXXX   11 1740 0c068d68       220 Enabled  00000000:00000000 000e8930     0 Ukn

    XXXX   1a 1144 05e1cdb0   200b220 Enabled  00000000:00000000 109b4460     1 Ukn

    XXXX   1b 1094 108ca1b0       220 Enabled  00000000:00000000 000e8930     0 Ukn

    then !do 026c106c

    which resulted in

    Name: System.StackOverflowException

    MethodTable: 04930dd8

    EEClass: 0475262c

    Size: 72(0x48) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    04930b24  40000b5        4        System.String  0 instance 00000000 _className

    0492ff98  40000b6        8 …ection.MethodBase  0 instance 00000000 _exceptionMethod

    04930b24  40000b7        c        System.String  0 instance 00000000 _exceptionMethodString

    04930b24  40000b8       10        System.String  0 instance 00000000 _message

    0492a480  40000b9       14 …tions.IDictionary  0 instance 00000000 _data

    04930cb8  40000ba       18     System.Exception  0 instance 00000000 _innerException

    04930b24  40000bb       1c        System.String  0 instance 00000000 _helpURL

    04930740  40000bc       20        System.Object  0 instance 00000000 _stackTrace

    04930b24  40000bd       24        System.String  0 instance 00000000 _stackTraceString

    04930b24  40000be       28        System.String  0 instance 00000000 _remoteStackTraceString

    04932d70  40000bf       34         System.Int32  1 instance        0 _remoteStackIndex

    04930740  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

    04932d70  40000c1       38         System.Int32  1 instance -2147023895 _HResult

    04930b24  40000c2       30        System.String  0 instance 00000000 _source

    049333ec  40000c3       3c        System.IntPtr  1 instance        0 _xptrs

    04932d70  40000c4       40         System.Int32  1 instance -532459699 _xcode

    But what do I do with a _remoteStackTraceString of 00000000?  What does this mean?  Any help would be GREATLY appreciated.

    Thanks,

    JP

  78. Tess says:

    Hi JP,

    Stackoverflows are a bit special in the sense that they are only 1st chance exceptions even though they are "fatal" which means that you wont automatically get dumps on the stackoverflow.

    Try following the blogs.msdn.com/…/net-debugging-demos-lab5-crash-review.aspx walkthrough and get a dump with the unknonwn.cfg attached to that post to get a dump of the actual stackoverflow to see if you have some infinite recursion going on.

    Tess

  79. SP says:

    Hey Tess

    My app server has frequent w3wp crashes and I got dumps from Debugdiag for the 2nd chance exception for the crashing w3wp process but dont know how to do drill down furhter. Can I have your thoughts about this?

    Report for w3wp__PID__6676__Date__04_14_2011__Time_04_19_20AM__724__Second_Chance_Exception_E0434F4D.dmp

    Type of Analysis Performed   Crash Analysis

    Operating System   Windows Server 2003 Service Pack 2

    Number Of Processors   2

    Process ID   6676

    Process Image   c:WINDOWSsystem32inetsrvw3wp.exe

    System Up-Time   13 day(s) 00:43:04

    Process Up-Time   07:18:09

    Thread 19 – System ID 3948

    Entry point   mscorwks!Thread::intermediateThreadProc

    Create time   4/13/2011 9:02:01 PM

    Time spent in user mode   0 Days 0:0:39.93

    Time spent in kernel mode   0 Days 0:0:1.671

    Function     Arg 1     Arg 2     Arg 3   Source

    kernel32!RaiseException+3c     e0434f4d     00000001     00000001    

    mscorwks!RaiseTheExceptionInternalOnly+2a8     26d6d490     00000000     00000000    

    mscorwks!RaiseTheException+4e     26d6d490     00000000     0725f954    

    mscorwks!RaiseTheException+c0     00000000     069519e0     ce105099    

    mscorwks!RealCOMPlusThrow+30     26d6d490     00000000     0725f960    

    mscorwks!RealCOMPlusThrow+d     26d6d490     88bd0db9     79f50648    

    mscorwks!Thread::RaiseCrossContextException+41f     00000000     0725f998     0725fa08    

    mscorwks!Thread::DoADCallBack+2a2     00000009     79ec434e     0725fb0c    

    mscorwks!Thread::DoADCallBack+310     0725fb0c     0725fab8     79fa6abb    

    mscorwks!Thread::ShouldChangeAbortToUnload+e3     0725fb0c     88bd0fd9     00000001    

    mscorwks!Thread::ShouldChangeAbortToUnload+30a     0725fb0c     00000009     00000000    

    mscorwks!Thread::ShouldChangeAbortToUnload+33e     00000009     79f47b65     00000000    

    mscorwks!ManagedThreadBase::ThreadPool+13     00000009     79f47b65     00000000    

    mscorwks!ManagedPerAppDomainTPCount::DispatchWorkItem+e9     00000000     00000000     77e619d1    

    mscorwks!ThreadpoolMgr::ExecuteWorkRequest+af     88bd08cd     00000000     79ec47b1    

    mscorwks!ThreadpoolMgr::WorkerThreadStart+20b     00000000     00000000     0725fcb8    

    mscorwks!Thread::intermediateThreadProc+49     06934538     00000000     00000000    

    kernel32!GetModuleHandleA+df     79f7571f     06934538     00000000    

    In w3wp__PID__6676__Date__04_14_2011__Time_04_19_20AM__724__Second_Chance_Exception_E0434F4D.dmp the assembly instruction at kernel32!RaiseException+3c in C:WINDOWSsystem32kernel32.dll from Microsoft Corporation has caused a CLR Exception of type (System.NullReferenceException) on thread 19

    This exception originated from mscorwks!RaiseTheExceptionInternalOnly+2a8. Module Information

    Image Name: C:WINDOWSsystem32kernel32.dll   Symbol Type:  Export

    Base address: 0x77e40000   Time Stamp:  Sat Mar 21 10:08:26 2009  

    Checksum: 0x00101b44   Comments:  

    COM DLL: False   Company Name:  Microsoft Corporation

    ISAPIExtension: False   File Description:  Windows NT BASE API Client DLL

    ISAPIFilter: False   File Version:  5.2.3790.4480 (srv03_sp2_gdr.090321-1244)

    Managed DLL: False   Internal Name:  kernel32

    VB DLL: False   Legal Copyright:  © Microsoft Corporation. All rights reserved.

    Loaded Image Name:  kernel32.dll   Legal Trademarks:  

    Mapped Image Name:     Original filename:  kernel32

    Module name:  kernel32   Private Build:  

    Single Threaded:  False   Product Name:  Microsoft® Windows® Operating System

    Module Size:  1.01 MBytes   Product Version:  5.2.3790.4480

    Symbol File Name:  kernel32.dll   Special Build:  &

    Thnks

    SP

  80. Tess says:

    Have you tried following the steps in the article, dumping out the exception etc.?  that should give you the callstack of the place where you got the exception

  81. SP says:

    Hey Tess,

    Tried debugging with windbg and got the below info but its not suggesting anything wrong about ths app,

    What do you think? Thanks for ur help in advance.

    0:018> !threads

    ThreadCount: 32

    UnstartedThread: 0

    BackgroundThread: 19

    PendingThread: 0

    DeadThread: 12

    Hosted Runtime: no

                                         PreEmptive   GC Alloc           Lock

          ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception

     11    1 149c 000d8f68   1808220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Worker)

     13    2 1988 000e4ef8      b220 Enabled  00000000:00000000 000d5a90     0 MTA (Finalizer)

     14    3 1d24 000fd988    80a220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Completion Port)

     15    4 1cd8 00100fd0      1220 Enabled  00000000:00000000 000d5a90     0 Ukn

      9    5 18b0 0012dbe8   180a220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Worker)

     17    7 15a8 05780b00   180b220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Worker)

     18    8  7ac 0579f660      b020 Enabled  1cee7ba8:1cee937c 000d5a90     0 MTA System.Runtime.Serialization.SerializationException (1cee606c)

     20    d 1774 058519a0   200b220 Enabled  00000000:00000000 057fc170     0 MTA

     25   20 1ba8 0832dc38   200b220 Enabled  00000000:00000000 112b5688     0 MTA

      3   12 18d4 113a15f0       220 Enabled  00000000:00000000 000d5a90     0 Ukn

      2   1b 1818 000fec40       220 Enabled  00000000:00000000 000d5a90     0 Ukn

     27   1c 1b8c 11560810   a80b220 Enabled  00000000:00000000 00101710     0 MTA (Threadpool Completion Port)

     28   10 1ce0 115b4b78   200b220 Enabled  00000000:00000000 11547d50     0 MTA

     29    e 1700 1687b9a8   200b220 Enabled  00000000:00000000 11547d50     0 MTA

     30    b 17f0 1154a0a8   200b220 Enabled  00000000:00000000 11547d50     0 MTA

      4   17 19ac 113fa338       220 Enabled  00000000:00000000 000d5a90     0 Ukn

     31   29  e98 16a202d8   880b220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Completion Port)

     33   2d 1c14 16a0f140   180b220 Enabled  00000000:00000000 000d5a90     0 MTA (Threadpool Worker)

    XXXX   30    0 1689eef0      9820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   2f    0 1696e880   8801820 Enabled  00000000:00000000 000d5a90     0 Ukn (Threadpool Completion Port)

    XXXX   27    0 1151caa8     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX    a    0 113788e8     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   2c    0 114a4a78     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   34    0 168b2680     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   38    0 16910868     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   33    0 168e0588     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   16    0 16959748     10820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   13    0 1685d9d0      9820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   21    0 0583da00      9820 Enabled  00000000:00000000 000d5a90     0 Ukn

    XXXX   1d    0 057b9bc0      9820 Enabled  00000000:00000000 000d5a90     0 Ukn

     43   2a 1f08 16a1f390   200b220 Enabled  00000000:00000000 00101710     0 MTA

     44   2e   fc 168191a0   200b220 Enabled  1ce26ce8:1ce28a18 00101710     0 MTA

    0:018> !do 1cee606c

    Name: System.Runtime.Serialization.SerializationException

    MethodTable: 79313888

    EEClass: 790e37d4

    Size: 72(0x48) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    79330ac4  40000b5        4        System.String  0 instance 1cee60c4 _className

    7932ff38  40000b6        8 …ection.MethodBase  0 instance 00000000 _exceptionMethod

    79330ac4  40000b7        c        System.String  0 instance 1cee6d68 _exceptionMethodString

    79330ac4  40000b8       10        System.String  0 instance 1cee6240 _message

    7932a420  40000b9       14 …tions.IDictionary  0 instance 00000000 _data

    79330c58  40000ba       18     System.Exception  0 instance 00000000 _innerException

    79330ac4  40000bb       1c        System.String  0 instance 00000000 _helpURL

    793306e0  40000bc       20        System.Object  0 instance 00000000 _stackTrace

    79330ac4  40000bd       24        System.String  0 instance 00000000 _stackTraceString

    79330ac4  40000be       28        System.String  0 instance 1cee73a0 _remoteStackTraceString

    79332d10  40000bf       34         System.Int32  1 instance        0 _remoteStackIndex

    793306e0  40000c0       2c        System.Object  0 instance 00000000 _dynamicMethods

    79332d10  40000c1       38         System.Int32  1 instance -2146233076 _HResult

    79330ac4  40000c2       30        System.String  0 instance 1cee7250 _source

    7933338c  40000c3       3c        System.IntPtr  1 instance        0 _xptrs

    79332d10  40000c4       40         System.Int32  1 instance        0 _xcode

    79330ac4  4000e4d      2a8        System.String  0   shared   static _nullMessage

       >> Domain:Value  000d5a90:1ceb63c8 00101710:NotInit  057fc170:NotInit  058058a8:NotInit  05862878:NotInit  112b5688:NotInit  114ab458:NotInit  11547d50:NotInit  168b6648:NotInit  <<

    0:018> !do 1cee73a0

    Name: System.String

    MethodTable: 79330ac4

    EEClass: 790ed65c

    Size: 2054(0x806) bytes

    (C:WINDOWSassemblyGAC_32mscorlib2.0.0.0__b77a5c561934e089mscorlib.dll)

    String:    at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

      at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)

      at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

      at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)

      at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject(Object obj, MemoryStream stm)

      at System.AppDomain.Serialize(Object o)

      at System.AppDomain.MarshalObject(Object o)

    Fields:

         MT    Field   Offset                 Type VT     Attr    Value Name

    79332d10  4000096        4         System.Int32  1 instance     1019 m_arrayLength

    79332d10  4000097        8         System.Int32  1 instance     1018 m_stringLength

    793317a4  4000098        c          System.Char  1 instance       20 m_firstChar

    79330ac4  4000099       10        System.String  0   shared   static Empty

       >> Domain:Value  000d5a90:025f1198 00101710:025f1198 057fc170:025f1198 058058a8:025f1198 05862878:025f1198 112b5688:025f1198 114ab458:025f1198 11547d50:025f1198 168b6648:025f1198 <<

    793316f4  400009a       14        System.Char[]  0   shared   static WhitespaceChars

       >> Domain:Value  000d5a90:025f16f0 00101710:025f63c8 057fc170:028c21c0 058058a8:02a72e6c 05862878:02b413d4 112b5688:027944cc 114ab458:0315b5f4 11547d50:0301534c 168b6648:14a3be14 <<