.NET Runtime 2.0 Error - I need more details...

G

Guest

When an asp.net exception occurs, an event is logged. The event that is
logged has lots and lots of details, app domain, trust level, virtual
directory and the execption information w/stack trace. Man that's good stuff.

When a compiled app, say a console with one line of code throwing an
exception fails, the framework logs an exception as well...

EventType clr20r3, P1 console20.exe, P2 1.0.0.0, P3 44d93615, P4 console20,
P5 1.0.0.0, P6 44d93615, P7 1, P8 b, P9 system.exception, P10 NIL.

It sure would be nice to have the exception information. I have tried with
a console app compiled for debugging and release with no success. Does
anyone know if this is possible?

Thanks in advance,
Ben
 
J

Jeffrey Tan[MSFT]

Hi Ben,

Yes, in .Net console application, you can use AppDomain.UnhandledException
event to get notification of any unhanlded exceptions in the current
appdomain. Then, you may use .Net Eventlog class to do the customized
logging logic.

However, there are several issues:
1. AppDomain.UnhandledException event is merely a notification, not a
handler, so if you can not use this event to handle the exception.
2. The default event logging behavior of console application is built into
the CLR, and CLR does not expose a property for us to turn-off it, so even
you have logged your customized information in AppDomain.UnhandledException
event, the CLR will still log the default information for you.

I strongly recommend the below article for you, it talks a lot of best
practise for unhandled exceptions in .Net, which covers all 3 types of .Net
applications, Console, Winform and Asp.net:
"Unexpected Errors in Managed Applications"
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/

Finally, if you are curious, the CLR implements the default logging by
providing a default Win32 unhandled exception filter, which native OS calls
it in KERNEL32!UnhandledExceptionFilter. So conceptually, you can still
disable the default logging behavior by providing a native Win32 unhandled
exception filter in the process, which will replace the CLR's default Win32
unhandled exception filter. However, I am not sure if this will have any
side effect and is not recommended to do.

Below is the default call stack information of the logging operation, just
for your information(The key point is the top few stack frames that start
from KERNEL32!UnhandledExceptionFilter):

ChildEBP RetAddr Caller,Callee
0012ee74 7a059ef6 mscorwks!EEPolicy::LogFatalError+0x271
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1085], calling ntdll!DbgBreakPoint
[d:\xpsprtm\base\ntos\rtl\i386\debug2.asm:42]
0012ee94 7c910833 ntdll!RtlpImageNtHeader+0x56
[d:\xpsprtm\base\published\obj\i386\ntrtl.h:4025], calling
ntdll!__SEH_epilog [d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012ee98 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012eeac 7c90e21f ntdll!NtQueryVirtualMemory+0xc
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1547]
0012eeb4 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012eeec 7c86346b KERNEL32!UnhandledExceptionFilter+0x8c3
[d:\xpsprtm\base\win32\client\thread.c:2183], calling KERNEL32!__SEH_epilog
[d:\xpsp\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012eef0 7c843622 KERNEL32!BaseProcessStart+0x39
[d:\xpsprtm\base\win32\client\support.c:578], calling
KERNEL32!UnhandledExceptionFilter
[d:\xpsprtm\base\win32\client\thread.c:1624]
0012eef8 7c839a54 KERNEL32!_except_handler3+0x61
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:244]
0012ef20 7c9037bf ntdll!ExecuteHandler2+0x26
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:224]
0012ef44 7c90378b ntdll!ExecuteHandler+0x24
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:184], calling
ntdll!ExecuteHandler2 [d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:198]
0012ef58 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012ef68 7c937860 ntdll!RtlDispatchException+0xb1
[d:\xpsprtm\base\ntos\rtl\i386\exdsptch.c:400], calling
ntdll!RtlpExecuteHandlerForException
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:97]
0012ef7c 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012ef94 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efa8 7c91b686 ntdll!RtlAllocateHeapSlowly+0x113b
[d:\xpsprtm\base\ntos\rtl\heap.c:3407], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efac 7c91b298 ntdll!RtlAllocateHeap+0xe64
[d:\xpsprtm\base\ntos\rtl\heap.c:1616], calling ntdll!RtlAllocateHeapSlowly
[d:\xpsprtm\base\ntos\rtl\heap.c:2498]
0012efb8 7c9106eb ntdll!RtlAllocateHeap+0xeac
[d:\xpsprtm\base\ntos\rtl\heap.c:2467], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efc8 79e7bf3e mscorwks!MethodDesc::IsRestored+0x2d
[f:\rtm\ndp\clr\src\vm\method.cpp:3644], calling
mscorwks!MethodTable::IsRestored [f:\rtm\ndp\clr\src\vm\methodtable.h:973]
0012efd0 79e7bea3 mscorwks!MethodDesc::CheckRestore+0x1b
[f:\rtm\ndp\clr\src\vm\method.cpp:3571], calling
mscorwks!MethodTable::IsFullyLoaded
[f:\rtm\ndp\clr\src\vm\methodtable.h:1018]
0012efe0 79e7dc72
mscorwks!MemberLoader::GetMethodDescFromMemberDefOrRefOrSpecThrowing+0x2df
[f:\rtm\ndp\clr\src\vm\memberload.cpp:633], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012eff4 7c90e25e ntdll!ZwRaiseException+0xc
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1571]
0012eff8 7c90eb15 ntdll!KiUserExceptionDispatcher+0x29
[d:\xpsprtm\base\ntos\rtl\i386\userdisp.asm:256], calling
ntdll!ZwRaiseException
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1571]
0012f2f0 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426] ====> Exception Code e0434f4d
cxr@12f024 exr@12f00c
0012f014 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f058 77e762d0 RPCRT4+0x62d0, calling RPCRT4+0x62d7
0012f080 77e80eeb RPCRT4+0x10eeb, calling RPCRT4+0x106d4
0012f0d8 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f10c 77e762d0 RPCRT4+0x62d0, calling RPCRT4+0x62d7
0012f14c 77e80eeb RPCRT4+0x10eeb, calling RPCRT4+0x106d4
0012f160 77e79578 RPCRT4+0x9578
0012f1a0 79e74435 mscorwks!DecCantStopCount+0x10
[f:\rtm\ndp\clr\src\vm\util.hpp:933], calling mscorwks!ClrFlsSetValue
[f:\rtm\ndp\clr\src\inc\clrhost.h:167]
0012f2fc 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f304 7a059471 mscorwks!EEPolicy::GetActionOnFailure+0x2d
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:432], calling
mscorwks!EEPolicy::GetFinalAction [f:\rtm\ndp\clr\src\vm\eepolicy.cpp:228]
0012f30c 79ebfe27 mscorwks!EEPolicy::GetActionOnFailure+0x8f
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f32c 7a05a1df mscorwks!EEPolicy::HandleFatalError+0x36
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1213], calling
mscorwks!EEPolicy::LogFatalError [f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1023]
0012f334 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012f344 79f97080 mscorwks!_CT??_R0PAVSEHException+0x20, calling
mscorwks!EEPolicy::HandleFatalError
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1194]
0012f34c 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012f3a4 7a0945a4 mscorwks!JIT_Throw+0xd0
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4745], calling
mscorwks!RaiseTheExceptionInternalOnly
[f:\rtm\ndp\clr\src\vm\excep.cpp:2678]
0012f418 7a0944ea mscorwks!JIT_Throw+0x1e
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4721], calling
mscorwks!LazyMachStateCaptureState
[f:\rtm\ndp\clr\src\vm\i386\gmsasm.asm:19]
0012f468 00e600ef (MethodDesc 0xa73120 +0x7f
ConsoleException.Program.Main(System.String[])), calling mscorwks!JIT_Throw
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4699]
0012f480 79e88f63 mscorwks!CallDescrWorker+0x33
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:936]
0012f490 79e88ee4 mscorwks!CallDescrWorkerWithHandler+0xa3
[f:\rtm\ndp\clr\src\vm\class.cpp:13568], calling mscorwks!CallDescrWorker
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:894]
0012f510 79e88e31 mscorwks!MethodDesc::CallDescr+0x19c
[f:\rtm\ndp\clr\src\vm\method.cpp:2344], calling
mscorwks!CallDescrWorkerWithHandler [f:\rtm\ndp\clr\src\vm\class.cpp:13552]
0012f540 79e88fe3 mscorwks!MetaSig::MetaSig+0x38
[f:\rtm\ndp\clr\src\vm\siginfo.hpp:388], calling MSVCR80!memcpy
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\memcpy.asm:101]
0012f54c 79e88db3 mscorwks!MethodDesc::CallDescr+0xaf
[f:\rtm\ndp\clr\src\vm\method.cpp:2140], calling
mscorwks!ClrSafeInt<unsigned long>::addition
[f:\rtm\ndp\clr\src\inc\safemath.h:510]
0012f558 79e88dc3 mscorwks!MethodDesc::CallDescr+0xbb
[f:\rtm\ndp\clr\src\vm\method.cpp:2145], calling mscorwks!_alloca_probe_16
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\alloca16.asm:44]
0012f5bc 79e7c34e mscorwks!CorSigEatCustomModifiers+0x1c
[f:\rtm\ndp\clr\src\inc\sigparser.h:79], calling
mscorwks!CorSigEatAnyVASentinel [f:\rtm\ndp\clr\src\inc\sigparser.h:39]
0012f5d8 79e7c301
mscorwks!CorSigEatCustomModifiersAndUncompressElementType+0x19
[f:\rtm\ndp\clr\src\inc\sigparser.h:180], calling
mscorwks!CorSigEatCustomModifiers [f:\rtm\ndp\clr\src\inc\sigparser.h:72]
0012f5f4 79f0776d mscorwks!ValidateMainMethod+0x15c
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6492], calling
mscorwks!CorSigEatCustomModifiersAndUncompressElementType
[f:\rtm\ndp\clr\src\inc\sigparser.h:173]
0012f60c 79e88d3b mscorwks!MethodDesc::CallDescr+0x1f
[f:\rtm\ndp\clr\src\vm\method.cpp:2028], calling mscorwks!_alloca_probe_16
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\alloca16.asm:44]
0012f650 79e88d19 mscorwks!MethodDesc::CallTargetWorker+0x20
[f:\rtm\ndp\clr\src\vm\method.cpp:1982], calling
mscorwks!MethodDesc::CallDescr [f:\rtm\ndp\clr\src\vm\method.cpp:1997]
0012f668 79e88cf6 mscorwks!MethodDescCallSite::Call_RetArgSlot+0x18
[f:\rtm\ndp\clr\src\vm\method.hpp:2315], calling
mscorwks!MethodDesc::CallTargetWorker
[f:\rtm\ndp\clr\src\vm\method.cpp:1942]
0012f67c 79f084b0 mscorwks!ClassLoader::RunMain+0x220
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6280], calling
mscorwks!MethodDescCallSite::Call_RetArgSlot
[f:\rtm\ndp\clr\src\vm\method.hpp:2315]
0012f788 79e7c34e mscorwks!CorSigEatCustomModifiers+0x1c
[f:\rtm\ndp\clr\src\inc\sigparser.h:79], calling
mscorwks!CorSigEatAnyVASentinel [f:\rtm\ndp\clr\src\inc\sigparser.h:39]
0012f7a4 79e7c301
mscorwks!CorSigEatCustomModifiersAndUncompressElementType+0x19
[f:\rtm\ndp\clr\src\inc\sigparser.h:180], calling
mscorwks!CorSigEatCustomModifiers [f:\rtm\ndp\clr\src\inc\sigparser.h:72]
0012f7c0 79f0776d mscorwks!ValidateMainMethod+0x15c
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6492], calling
mscorwks!CorSigEatCustomModifiersAndUncompressElementType
[f:\rtm\ndp\clr\src\inc\sigparser.h:173]
0012f7e0 79f082a9 mscorwks!Assembly::ExecuteMainMethod+0xa6
[f:\rtm\ndp\clr\src\vm\assembly.cpp:1617], calling
mscorwks!ClassLoader::RunMain [f:\rtm\ndp\clr\src\vm\clsload.cpp:6178]
0012f834 79e7473a mscorwks!CrstBase::Leave+0x77
[f:\rtm\ndp\clr\src\vm\crst.cpp:430], calling
mscorwks!UnsafeEELeaveCriticalSection [f:\rtm\ndp\clr\src\vm\common.h:367]
0012f838 79e74753 mscorwks!CrstBase::Leave+0x96
[f:\rtm\ndp\clr\src\vm\crst.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f860 79e74753 mscorwks!CrstBase::Leave+0x96
[f:\rtm\ndp\clr\src\vm\crst.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f874 7c926abe ntdll!RtlFreeHeapSlowly+0x5c2
[d:\xpsprtm\base\ntos\rtl\heap.c:4334], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f888 7c926abe ntdll!RtlFreeHeapSlowly+0x5c2
[d:\xpsprtm\base\ntos\rtl\heap.c:4334], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f88c 7c9268ad ntdll!RtlFreeHeap+0xf9
[d:\xpsprtm\base\ntos\rtl\heap.c:3534], calling ntdll!RtlFreeHeapSlowly
[d:\xpsprtm\base\ntos\rtl\heap.c:3927]
0012f898 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f8bc 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f8c0 79e7839d mscorwks!EEHeapFreeInProcessHeap+0x21
[f:\rtm\ndp\clr\src\vm\hosting.cpp:653], calling mscorwks!EEHeapFree
[f:\rtm\ndp\clr\src\vm\hosting.cpp:577]
0012f8d0 79e71862 mscorwks!SaveLastErrorHolder::~SaveLastErrorHolder+0x14
[f:\rtm\ndp\clr\src\inc\holder.h:995], calling ntdll!RtlGetLastWin32Error
[d:\xpsprtm\base\ntos\rtl\error.c:212]
0012f8d8 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f900 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f904 79e9fc8d mscorwks!FileLoadLock::`scalar deleting destructor'+0x15,
calling mscorwks!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012f944 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f958 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f95c 79e783ca mscorwks!EEHeapFree+0x83
[f:\rtm\ndp\clr\src\vm\hosting.cpp:631], calling ntdll!RtlFreeHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:3437]
0012f968 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f97c 79e7a39e mscorwks!_EH_epilog3_catch_GS+0xa
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:615],
calling mscorwks!__security_check_cookie
[f:\rtm\vctools\crt_bld\self_x86\crt\src\intel\secchk.c:52]
0012f980 79ec44d2 mscorwks!AppDomain::GetFriendlyNameForDebugger+0x182
[f:\rtm\ndp\clr\src\vm\appdomain.cpp:6019], calling
mscorwks!_EH_epilog3_catch_GS
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:609]
0012f990 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f994 79e7839d mscorwks!EEHeapFreeInProcessHeap+0x21
[f:\rtm\ndp\clr\src\vm\hosting.cpp:653], calling mscorwks!EEHeapFree
[f:\rtm\ndp\clr\src\vm\hosting.cpp:577]
0012f9a4 79e71862 mscorwks!SaveLastErrorHolder::~SaveLastErrorHolder+0x14
[f:\rtm\ndp\clr\src\inc\holder.h:995], calling ntdll!RtlGetLastWin32Error
[d:\xpsprtm\base\ntos\rtl\error.c:212]
0012f9ac 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9d4 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9d8 79e7a9ff mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x21,
calling mscorwks!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012f9dc 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9fc 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa20 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa24 79e7ee67 mscorwks!InlineSArray<MdaXmlElement
*,16,1>::~InlineSArray<MdaXmlElement *,16,1>+0x1d, calling
mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa38 79e7a773 mscorwks!Thread::EnablePreemptiveGC+0xf
[f:\rtm\ndp\clr\src\vm\threads.h:1925], calling
mscorwks!Thread::CatchAtSafePoint [f:\rtm\ndp\clr\src\vm\threads.h:1156]
0012fa48 79f0817e mscorwks!SystemDomain::ExecuteMainMethod+0x398
[f:\rtm\ndp\clr\src\vm\appdomain.cpp:2799], calling
mscorwks!Assembly::ExecuteMainMethod
[f:\rtm\ndp\clr\src\vm\assembly.cpp:1589]
0012fb4c 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fb50 79e8dd55 mscorwks!CStructArray::Clear+0x15
[f:\rtm\ndp\clr\src\utilcode\util.cpp:1075], calling mscorwks!operator
delete [f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012fb60 79e87b53 mscorwks!CMiniMd::CommonGetCustomAttributeByName+0x7a
[f:\rtm\ndp\clr\src\md\runtime\metamodelro.cpp:398], calling
mscorwks!HENUMInternal::ClearEnum [f:\rtm\ndp\clr\src\md\enc\rwutil.cpp:126]
0012fb68 79e8837c mscorwks!HardCodedMetaSig::GetBinarySig+0x146
[f:\rtm\ndp\clr\src\vm\siginfo.cpp:3862], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fb94 7c926abe ntdll!RtlFreeHeapSlowly+0x5c2
[d:\xpsprtm\base\ntos\rtl\heap.c:4334], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012fb98 7c9268ad ntdll!RtlFreeHeap+0xf9
[d:\xpsprtm\base\ntos\rtl\heap.c:3534], calling ntdll!RtlFreeHeapSlowly
[d:\xpsprtm\base\ntos\rtl\heap.c:3927]
0012fba4 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012fbd4 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012fbd8 7c911962 ntdll!RtlpFreeDebugInfo+0x5c
[d:\xpsprtm\base\ntdll\resource.c:220], calling ntdll!RtlFreeHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:3437]
0012fbdc 7c911993 ntdll!RtlpFreeDebugInfo+0x77
[d:\xpsprtm\base\ntdll\resource.c:224], calling
ntdll!RtlLeaveCriticalSection [d:\xpsprtm\base\ntdll\i386\critsect.asm:271]
0012fbe4 7c911970 ntdll!RtlpFreeDebugInfo+0x6a
[d:\xpsprtm\base\ntdll\resource.c:228], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012fbfc 79e744b5 mscorwks!UnsafeEELeaveCriticalSection+0x1d
[f:\rtm\ndp\clr\src\vm\common.h:373], calling (JitHelp:
CORINFO_HELP_GET_THREAD)
0012fc04 79e744a2 mscorwks!UnsafeEELeaveCriticalSection+0xa
[f:\rtm\ndp\clr\src\vm\common.h:371], calling ntdll!RtlLeaveCriticalSection
[d:\xpsprtm\base\ntdll\i386\critsect.asm:271]
0012fc08 79e744b5 mscorwks!UnsafeEELeaveCriticalSection+0x1d
[f:\rtm\ndp\clr\src\vm\common.h:373], calling (JitHelp:
CORINFO_HELP_GET_THREAD)
0012fc0c 79e7473a mscorwks!CrstBase::Leave+0x77
[f:\rtm\ndp\clr\src\vm\crst.cpp:430], calling
mscorwks!UnsafeEELeaveCriticalSection [f:\rtm\ndp\clr\src\vm\common.h:367]
0012fc10 79e74753 mscorwks!CrstBase::Leave+0x96
[f:\rtm\ndp\clr\src\vm\crst.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fc28 79004811 mscoree!XMLParserShimFileStream::`scalar deleting
destructor'+0x15, calling mscoree!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012fc50 79e78360 mscorwks!EEHeapAlloc+0x12d
[f:\rtm\ndp\clr\src\vm\hosting.cpp:527], calling ntdll!RtlAllocateHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:1539]
0012fc64 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012fc68 79e783ca mscorwks!EEHeapFree+0x83
[f:\rtm\ndp\clr\src\vm\hosting.cpp:631], calling ntdll!RtlFreeHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:3437]
0012fc74 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fc88 79e7837f mscorwks!EEHeapAlloc+0x163
[f:\rtm\ndp\clr\src\vm\hosting.cpp:554], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fc8c 79e78331 mscorwks!EEHeapAllocInProcessHeap+0x51
[f:\rtm\ndp\clr\src\vm\hosting.cpp:574], calling mscorwks!EEHeapAlloc
[f:\rtm\ndp\clr\src\vm\hosting.cpp:441]
0012fc9c 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fca0 79e7839d mscorwks!EEHeapFreeInProcessHeap+0x21
[f:\rtm\ndp\clr\src\vm\hosting.cpp:653], calling mscorwks!EEHeapFree
[f:\rtm\ndp\clr\src\vm\hosting.cpp:577]
0012fcb0 79e71862 mscorwks!SaveLastErrorHolder::~SaveLastErrorHolder+0x14
[f:\rtm\ndp\clr\src\inc\holder.h:995], calling ntdll!RtlGetLastWin32Error
[d:\xpsprtm\base\ntos\rtl\error.c:212]
0012fcb8 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fce0 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fce4 79e7a9ff mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x21,
calling mscorwks!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012fce8 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fdb0 79e8837c mscorwks!HardCodedMetaSig::GetBinarySig+0x146
[f:\rtm\ndp\clr\src\vm\siginfo.cpp:3862], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fdb4 79e8a800 mscorwks!Binder::FetchMethod+0x5a
[f:\rtm\ndp\clr\src\vm\binder.cpp:508], calling
mscorwks!HardCodedMetaSig::GetBinarySig
[f:\rtm\ndp\clr\src\vm\siginfo.cpp:3769]
0012fdcc 79e83493 mscorwks!Binder::CheckInit+0xb
[f:\rtm\ndp\clr\src\vm\binder.cpp:399], calling
mscorwks!MethodTable::IsClassInited
[f:\rtm\ndp\clr\src\vm\methodtable.cpp:388]
0012fdd4 79e8a797 mscorwks!Binder::GetMethod+0x63
[f:\rtm\ndp\clr\src\vm\binder.cpp:636], calling mscorwks!Binder::CheckInit
[f:\rtm\ndp\clr\src\vm\binder.cpp:389]
0012fdd8 79e8a7ab mscorwks!Binder::GetMethod+0x79
[f:\rtm\ndp\clr\src\vm\binder.cpp:639], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fddc 79ebfe27 mscorwks!EEPolicy::GetActionOnFailure+0x8f
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fe00 79e786aa mscorwks!CLRException::HandlerState::CleanupTry+0x13
[f:\rtm\ndp\clr\src\vm\clrex.cpp:771], calling mscorwks!GetCurrentSEHRecord
[f:\rtm\ndp\clr\src\vm\i386\excepx86.cpp:1830]
0012fe10 79eb80fa mscorwks!EEStartupHelper+0x7a3
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:876], calling
mscorwks!CLRException::HandlerState::CleanupTry
[f:\rtm\ndp\clr\src\vm\clrex.cpp:759]
0012fe28 79eb8141 mscorwks!EEStartupHelper+0x8d2
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:900], calling
mscorwks!__security_check_cookie
[f:\rtm\vctools\crt_bld\self_x86\crt\src\intel\secchk.c:52]
0012fe4c 79ed91f3 mscorwks!REGUTIL::InitOptionalConfigCache+0x186
[f:\rtm\ndp\clr\src\utilcode\regutil.cpp:1459], calling
mscorwks!SString::CaseCompareHelper
[f:\rtm\ndp\clr\src\utilcode\sstring.cpp:103]
0012feb8 7c9106eb ntdll!RtlAllocateHeap+0xeac
[d:\xpsprtm\base\ntos\rtl\heap.c:2467], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012febc 79e78360 mscorwks!EEHeapAlloc+0x12d
[f:\rtm\ndp\clr\src\vm\hosting.cpp:527], calling ntdll!RtlAllocateHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:1539]
0012feec 79ebc7d8 mscorwks!EEStartup+0x50
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:949], calling mscorwks!EEStartupHelper
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:484]
0012fef0 79ebc7f7 mscorwks!EEStartup+0x75
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:955], calling mscorwks!__SEH_epilog4
0012ff18 79f07dc7 mscorwks!ExecuteEXE+0x59
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:2370], calling
mscorwks!SystemDomain::ExecuteMainMethod
[f:\rtm\ndp\clr\src\vm\appdomain.cpp:2659]
0012ff68 79f05f61 mscorwks!_CorExeMain+0x11b
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:2220], calling mscorwks!ExecuteEXE
[f:\rtm\ndp\clr\src\vm\ceemain.cpp:2355]
0012ffb0 79011b5f mscoree!_CorExeMain+0x2c
[f:\rtm\ndp\clr\src\dlls\shim\shim.cpp:5877]
0012ffc0 7c816d4f KERNEL32!BaseProcessStart+0x23
[d:\xpsprtm\base\win32\client\support.c:576]
0012ffe0 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Jeffrey,

Thank you for your response. I will read it and the link you posted right
now. I just wanted to clarify one thing, the event logging that I'm talking
about is simply the default application event log entries made by the
framework when an unhandled exception occurs. Our system administrators have
setup an email notification to a maintenance mailbox whenever a .net event
shows up in the application event log. This is handy for problems that are
sneaking past us and our error handlers. For the asp.net unhandled
exceptions, the clr will write a very detailed event description as I
mentioned in my original post. For console appications however, the clr will
write a very generic ".NET Runtime 2.0 Error" that has almost no information.

My question is, can I get the clr to log an application event log entry with
more information. I know this can be done on a per application basis and
possibly more with custom code, but I was hoping I could get more out of the
default event with a little configuration...

Thanks,
Ben


"Jeffrey Tan[MSFT]" said:
Hi Ben,

Yes, in .Net console application, you can use AppDomain.UnhandledException
event to get notification of any unhanlded exceptions in the current
appdomain. Then, you may use .Net Eventlog class to do the customized
logging logic.

However, there are several issues:
1. AppDomain.UnhandledException event is merely a notification, not a
handler, so if you can not use this event to handle the exception.
2. The default event logging behavior of console application is built into
the CLR, and CLR does not expose a property for us to turn-off it, so even
you have logged your customized information in AppDomain.UnhandledException
event, the CLR will still log the default information for you.

I strongly recommend the below article for you, it talks a lot of best
practise for unhandled exceptions in .Net, which covers all 3 types of .Net
applications, Console, Winform and Asp.net:
"Unexpected Errors in Managed Applications"
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/

Finally, if you are curious, the CLR implements the default logging by
providing a default Win32 unhandled exception filter, which native OS calls
it in KERNEL32!UnhandledExceptionFilter. So conceptually, you can still
disable the default logging behavior by providing a native Win32 unhandled
exception filter in the process, which will replace the CLR's default Win32
unhandled exception filter. However, I am not sure if this will have any
side effect and is not recommended to do.

Below is the default call stack information of the logging operation, just
for your information(The key point is the top few stack frames that start
from KERNEL32!UnhandledExceptionFilter):

ChildEBP RetAddr Caller,Callee
0012ee74 7a059ef6 mscorwks!EEPolicy::LogFatalError+0x271
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1085], calling ntdll!DbgBreakPoint
[d:\xpsprtm\base\ntos\rtl\i386\debug2.asm:42]
0012ee94 7c910833 ntdll!RtlpImageNtHeader+0x56
[d:\xpsprtm\base\published\obj\i386\ntrtl.h:4025], calling
ntdll!__SEH_epilog [d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012ee98 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012eeac 7c90e21f ntdll!NtQueryVirtualMemory+0xc
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1547]
0012eeb4 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012eeec 7c86346b KERNEL32!UnhandledExceptionFilter+0x8c3
[d:\xpsprtm\base\win32\client\thread.c:2183], calling KERNEL32!__SEH_epilog
[d:\xpsp\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012eef0 7c843622 KERNEL32!BaseProcessStart+0x39
[d:\xpsprtm\base\win32\client\support.c:578], calling
KERNEL32!UnhandledExceptionFilter
[d:\xpsprtm\base\win32\client\thread.c:1624]
0012eef8 7c839a54 KERNEL32!_except_handler3+0x61
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:244]
0012ef20 7c9037bf ntdll!ExecuteHandler2+0x26
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:224]
0012ef44 7c90378b ntdll!ExecuteHandler+0x24
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:184], calling
ntdll!ExecuteHandler2 [d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:198]
0012ef58 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012ef68 7c937860 ntdll!RtlDispatchException+0xb1
[d:\xpsprtm\base\ntos\rtl\i386\exdsptch.c:400], calling
ntdll!RtlpExecuteHandlerForException
[d:\xpsprtm\base\ntos\rtl\i386\xcptmisc.asm:97]
0012ef7c 7c8399f3 KERNEL32!_except_handler3
[D:\xpsp\base\crts\crtw32\misc\i386\exsup3.asm:174]
0012ef94 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efa8 7c91b686 ntdll!RtlAllocateHeapSlowly+0x113b
[d:\xpsprtm\base\ntos\rtl\heap.c:3407], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efac 7c91b298 ntdll!RtlAllocateHeap+0xe64
[d:\xpsprtm\base\ntos\rtl\heap.c:1616], calling ntdll!RtlAllocateHeapSlowly
[d:\xpsprtm\base\ntos\rtl\heap.c:2498]
0012efb8 7c9106eb ntdll!RtlAllocateHeap+0xeac
[d:\xpsprtm\base\ntos\rtl\heap.c:2467], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012efc8 79e7bf3e mscorwks!MethodDesc::IsRestored+0x2d
[f:\rtm\ndp\clr\src\vm\method.cpp:3644], calling
mscorwks!MethodTable::IsRestored [f:\rtm\ndp\clr\src\vm\methodtable.h:973]
0012efd0 79e7bea3 mscorwks!MethodDesc::CheckRestore+0x1b
[f:\rtm\ndp\clr\src\vm\method.cpp:3571], calling
mscorwks!MethodTable::IsFullyLoaded
[f:\rtm\ndp\clr\src\vm\methodtable.h:1018]
0012efe0 79e7dc72
mscorwks!MemberLoader::GetMethodDescFromMemberDefOrRefOrSpecThrowing+0x2df
[f:\rtm\ndp\clr\src\vm\memberload.cpp:633], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012eff4 7c90e25e ntdll!ZwRaiseException+0xc
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1571]
0012eff8 7c90eb15 ntdll!KiUserExceptionDispatcher+0x29
[d:\xpsprtm\base\ntos\rtl\i386\userdisp.asm:256], calling
ntdll!ZwRaiseException
[d:\xpsprtm\base\ntdll\daytona\obj\i386\usrstubs.asm:1571]
0012f2f0 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426] ====> Exception Code e0434f4d
cxr@12f024 exr@12f00c
0012f014 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f058 77e762d0 RPCRT4+0x62d0, calling RPCRT4+0x62d7
0012f080 77e80eeb RPCRT4+0x10eeb, calling RPCRT4+0x106d4
0012f0d8 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f10c 77e762d0 RPCRT4+0x62d0, calling RPCRT4+0x62d7
0012f14c 77e80eeb RPCRT4+0x10eeb, calling RPCRT4+0x106d4
0012f160 77e79578 RPCRT4+0x9578
0012f1a0 79e74435 mscorwks!DecCantStopCount+0x10
[f:\rtm\ndp\clr\src\vm\util.hpp:933], calling mscorwks!ClrFlsSetValue
[f:\rtm\ndp\clr\src\inc\clrhost.h:167]
0012f2fc 7c81eb33 KERNEL32!RaiseException+0x53
[d:\xpsprtm\base\win32\client\thread.c:1426], calling
ntdll!RtlRaiseException [d:\xpsprtm\base\ntos\rtl\i386\raise.asm:83]
0012f304 7a059471 mscorwks!EEPolicy::GetActionOnFailure+0x2d
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:432], calling
mscorwks!EEPolicy::GetFinalAction [f:\rtm\ndp\clr\src\vm\eepolicy.cpp:228]
0012f30c 79ebfe27 mscorwks!EEPolicy::GetActionOnFailure+0x8f
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f32c 7a05a1df mscorwks!EEPolicy::HandleFatalError+0x36
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1213], calling
mscorwks!EEPolicy::LogFatalError [f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1023]
0012f334 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012f344 79f97080 mscorwks!_CT??_R0PAVSEHException+0x20, calling
mscorwks!EEPolicy::HandleFatalError
[f:\rtm\ndp\clr\src\vm\eepolicy.cpp:1194]
0012f34c 79f97075 mscorwks!RaiseTheExceptionInternalOnly+0x236
[f:\rtm\ndp\clr\src\vm\excep.cpp:2848], calling mscorwks!GetCurrentIP
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:1712]
0012f3a4 7a0945a4 mscorwks!JIT_Throw+0xd0
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4745], calling
mscorwks!RaiseTheExceptionInternalOnly
[f:\rtm\ndp\clr\src\vm\excep.cpp:2678]
0012f418 7a0944ea mscorwks!JIT_Throw+0x1e
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4721], calling
mscorwks!LazyMachStateCaptureState
[f:\rtm\ndp\clr\src\vm\i386\gmsasm.asm:19]
0012f468 00e600ef (MethodDesc 0xa73120 +0x7f
ConsoleException.Program.Main(System.String[])), calling mscorwks!JIT_Throw
[f:\rtm\ndp\clr\src\vm\jithelpers.cpp:4699]
0012f480 79e88f63 mscorwks!CallDescrWorker+0x33
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:936]
0012f490 79e88ee4 mscorwks!CallDescrWorkerWithHandler+0xa3
[f:\rtm\ndp\clr\src\vm\class.cpp:13568], calling mscorwks!CallDescrWorker
[f:\rtm\ndp\clr\src\vm\i386\asmhelpers.asm:894]
0012f510 79e88e31 mscorwks!MethodDesc::CallDescr+0x19c
[f:\rtm\ndp\clr\src\vm\method.cpp:2344], calling
mscorwks!CallDescrWorkerWithHandler [f:\rtm\ndp\clr\src\vm\class.cpp:13552]
0012f540 79e88fe3 mscorwks!MetaSig::MetaSig+0x38
[f:\rtm\ndp\clr\src\vm\siginfo.hpp:388], calling MSVCR80!memcpy
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\memcpy.asm:101]
0012f54c 79e88db3 mscorwks!MethodDesc::CallDescr+0xaf
[f:\rtm\ndp\clr\src\vm\method.cpp:2140], calling
mscorwks!ClrSafeInt<unsigned long>::addition
[f:\rtm\ndp\clr\src\inc\safemath.h:510]
0012f558 79e88dc3 mscorwks!MethodDesc::CallDescr+0xbb
[f:\rtm\ndp\clr\src\vm\method.cpp:2145], calling mscorwks!_alloca_probe_16
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\alloca16.asm:44]
0012f5bc 79e7c34e mscorwks!CorSigEatCustomModifiers+0x1c
[f:\rtm\ndp\clr\src\inc\sigparser.h:79], calling
mscorwks!CorSigEatAnyVASentinel [f:\rtm\ndp\clr\src\inc\sigparser.h:39]
0012f5d8 79e7c301
mscorwks!CorSigEatCustomModifiersAndUncompressElementType+0x19
[f:\rtm\ndp\clr\src\inc\sigparser.h:180], calling
mscorwks!CorSigEatCustomModifiers [f:\rtm\ndp\clr\src\inc\sigparser.h:72]
0012f5f4 79f0776d mscorwks!ValidateMainMethod+0x15c
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6492], calling
mscorwks!CorSigEatCustomModifiersAndUncompressElementType
[f:\rtm\ndp\clr\src\inc\sigparser.h:173]
0012f60c 79e88d3b mscorwks!MethodDesc::CallDescr+0x1f
[f:\rtm\ndp\clr\src\vm\method.cpp:2028], calling mscorwks!_alloca_probe_16
[F:\RTM\vctools\crt_bld\SELF_X86\crt\src\intel\alloca16.asm:44]
0012f650 79e88d19 mscorwks!MethodDesc::CallTargetWorker+0x20
[f:\rtm\ndp\clr\src\vm\method.cpp:1982], calling
mscorwks!MethodDesc::CallDescr [f:\rtm\ndp\clr\src\vm\method.cpp:1997]
0012f668 79e88cf6 mscorwks!MethodDescCallSite::Call_RetArgSlot+0x18
[f:\rtm\ndp\clr\src\vm\method.hpp:2315], calling
mscorwks!MethodDesc::CallTargetWorker
[f:\rtm\ndp\clr\src\vm\method.cpp:1942]
0012f67c 79f084b0 mscorwks!ClassLoader::RunMain+0x220
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6280], calling
mscorwks!MethodDescCallSite::Call_RetArgSlot
[f:\rtm\ndp\clr\src\vm\method.hpp:2315]
0012f788 79e7c34e mscorwks!CorSigEatCustomModifiers+0x1c
[f:\rtm\ndp\clr\src\inc\sigparser.h:79], calling
mscorwks!CorSigEatAnyVASentinel [f:\rtm\ndp\clr\src\inc\sigparser.h:39]
0012f7a4 79e7c301
mscorwks!CorSigEatCustomModifiersAndUncompressElementType+0x19
[f:\rtm\ndp\clr\src\inc\sigparser.h:180], calling
mscorwks!CorSigEatCustomModifiers [f:\rtm\ndp\clr\src\inc\sigparser.h:72]
0012f7c0 79f0776d mscorwks!ValidateMainMethod+0x15c
[f:\rtm\ndp\clr\src\vm\clsload.cpp:6492], calling
mscorwks!CorSigEatCustomModifiersAndUncompressElementType
[f:\rtm\ndp\clr\src\inc\sigparser.h:173]
0012f7e0 79f082a9 mscorwks!Assembly::ExecuteMainMethod+0xa6
[f:\rtm\ndp\clr\src\vm\assembly.cpp:1617], calling
mscorwks!ClassLoader::RunMain [f:\rtm\ndp\clr\src\vm\clsload.cpp:6178]
0012f834 79e7473a mscorwks!CrstBase::Leave+0x77
[f:\rtm\ndp\clr\src\vm\crst.cpp:430], calling
mscorwks!UnsafeEELeaveCriticalSection [f:\rtm\ndp\clr\src\vm\common.h:367]
0012f838 79e74753 mscorwks!CrstBase::Leave+0x96
[f:\rtm\ndp\clr\src\vm\crst.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f860 79e74753 mscorwks!CrstBase::Leave+0x96
[f:\rtm\ndp\clr\src\vm\crst.cpp:448], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f874 7c926abe ntdll!RtlFreeHeapSlowly+0x5c2
[d:\xpsprtm\base\ntos\rtl\heap.c:4334], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f888 7c926abe ntdll!RtlFreeHeapSlowly+0x5c2
[d:\xpsprtm\base\ntos\rtl\heap.c:4334], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f88c 7c9268ad ntdll!RtlFreeHeap+0xf9
[d:\xpsprtm\base\ntos\rtl\heap.c:3534], calling ntdll!RtlFreeHeapSlowly
[d:\xpsprtm\base\ntos\rtl\heap.c:3927]
0012f898 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f8bc 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f8c0 79e7839d mscorwks!EEHeapFreeInProcessHeap+0x21
[f:\rtm\ndp\clr\src\vm\hosting.cpp:653], calling mscorwks!EEHeapFree
[f:\rtm\ndp\clr\src\vm\hosting.cpp:577]
0012f8d0 79e71862 mscorwks!SaveLastErrorHolder::~SaveLastErrorHolder+0x14
[f:\rtm\ndp\clr\src\inc\holder.h:995], calling ntdll!RtlGetLastWin32Error
[d:\xpsprtm\base\ntos\rtl\error.c:212]
0012f8d8 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f900 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f904 79e9fc8d mscorwks!FileLoadLock::`scalar deleting destructor'+0x15,
calling mscorwks!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012f944 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f958 7c91056d ntdll!RtlFreeHeap+0x647
[d:\xpsprtm\base\ntos\rtl\heap.c:3895], calling ntdll!__SEH_epilog
[d:\xpsprtm\base\crts\crtw32\misc\i386\sehprolg.asm:55]
0012f95c 79e783ca mscorwks!EEHeapFree+0x83
[f:\rtm\ndp\clr\src\vm\hosting.cpp:631], calling ntdll!RtlFreeHeap
[d:\xpsprtm\base\ntos\rtl\heap.c:3437]
0012f968 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f97c 79e7a39e mscorwks!_EH_epilog3_catch_GS+0xa
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:615],
calling mscorwks!__security_check_cookie
[f:\rtm\vctools\crt_bld\self_x86\crt\src\intel\secchk.c:52]
0012f980 79ec44d2 mscorwks!AppDomain::GetFriendlyNameForDebugger+0x182
[f:\rtm\ndp\clr\src\vm\appdomain.cpp:6019], calling
mscorwks!_EH_epilog3_catch_GS
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:609]
0012f990 79e783e6 mscorwks!EEHeapFree+0xa5
[f:\rtm\ndp\clr\src\vm\hosting.cpp:638], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f994 79e7839d mscorwks!EEHeapFreeInProcessHeap+0x21
[f:\rtm\ndp\clr\src\vm\hosting.cpp:653], calling mscorwks!EEHeapFree
[f:\rtm\ndp\clr\src\vm\hosting.cpp:577]
0012f9a4 79e71862 mscorwks!SaveLastErrorHolder::~SaveLastErrorHolder+0x14
[f:\rtm\ndp\clr\src\inc\holder.h:995], calling ntdll!RtlGetLastWin32Error
[d:\xpsprtm\base\ntos\rtl\error.c:212]
0012f9ac 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9d4 79e782ed mscorwks!operator delete+0x41
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:833], calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9d8 79e7a9ff mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x21,
calling mscorwks!operator delete
[f:\rtm\ndp\clr\src\utilcode\clrhost.cpp:826]
0012f9dc 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012f9fc 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa20 79e7a9f6 mscorwks!InlineSBuffer<5941>::~InlineSBuffer<5941>+0x27,
calling mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa24 79e7ee67 mscorwks!InlineSArray<MdaXmlElement
*,16,1>::~InlineSArray<MdaXmlElement *,16,1>+0x1d, calling
mscorwks!_EH_epilog3
[f:\rtm\vctools\crt_bld\self_x86\crt\prebuild\eh\i386\ehprolg3.c:534]
0012fa38 79e7a773 mscorwks!Thread::EnablePreemptiveGC+0xf
[f:\rtm\ndp\clr\src\vm\threads.h:1925], calling
mscorwks!Thread::CatchAtSafePoint [f:\rtm\ndp\clr\src\vm\threads.h:1156]
0012fa48 79f0817e mscorwks!SystemDomain::ExecuteMainMethod+0x398
[f:\rtm\ndp\clr\src\vm\appdomain.cpp:2799], calling
mscorwks!Assembly::ExecuteMainMethod
 
J

Jeffrey Tan[MSFT]

Hi Ben,

Yes, I see your concern. Since your team is monitorring eventlog, so the
most straightforward way of getting what you want is notifying the CLR to
log the customized information you want.

However, the logging code is buried in the CLR not any classes of FCL, and
it seems that CLR did not expose an interface for us to customize the
logging information, so we can not get this done with this approach.

The simplest workaround I can think of is wrapping all the code in Main
method with a big try...catch clause. Then in this catch clause, you may
write some customized event logging code at will. Since the any exception
in the main method is caught by your code, CLR will not do the default
logging for you. This approach is also demonstrated in the MSDN article I
provided you in last reply.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
B

Ben

Jeffery,

Thanks for your input. It's unfortunate that asp.net exceptions are logged
with a great amount of detail while everything else just says something bad
happened. We'll start coding all applications with event log exception
handling for now.

One of the issues for example is this exception:
Event Log Message from xxxxxxxxx at 10:21:05 AM

Error Event 5000 in the Application log

From .NET Runtime 2.0 Error Reporting (User None)

------------------------------

EventType clr20r3, P1 lkkevw5rnuhx5jth2wldstavdxfhamfm, P2 1.0.0.0, P3
449bfc41, P4 system, P5 2.0.0.0, P6 4333ae87, P7 2bc2, P8 17, P9
system.net.sockets.socket, P10 NIL.

Not much to work with there, is that even one of our programs? Who knows...
I hope that with a service release or something Microsoft can update the
default execption logging for the clr & non-asp.net exceptions.

Thanks,
Ben


"Jeffrey Tan[MSFT]" said:
Hi Ben,

Yes, I see your concern. Since your team is monitorring eventlog, so the
most straightforward way of getting what you want is notifying the CLR to
log the customized information you want.

However, the logging code is buried in the CLR not any classes of FCL, and
it seems that CLR did not expose an interface for us to customize the
logging information, so we can not get this done with this approach.

The simplest workaround I can think of is wrapping all the code in Main
method with a big try...catch clause. Then in this catch clause, you may
write some customized event logging code at will. Since the any exception
in the main method is caught by your code, CLR will not do the default
logging for you. This approach is also demonstrated in the MSDN article I
provided you in last reply.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
J

Jeffrey Tan[MSFT]

Hi Ben,

Yes, I think your concern makes sense. If the CLR logs the same information
to eventlog as Asp.net, it would save developer time to find out the root
cause. I will try to forward your suggestion to our CLR team internally.

Since my feedback goes from internal channel, which is invisible to public,
it is also a good chance for you to submit a feedback to our CLR team from
the site below:
"Visual Studio and .NET Framework Feedback "
http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Based on my experience, our developer team will receive your feedback and
follow up in the feedback link with you.

Anyway, if you need any further help on implementing the customization
eventlog in exception handler, please feel free to post, I will work with
you. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top