Getting at the source of a nested exception (TypeInitializationException)
- From: "Ole Nielsby" <ole.nielsby@xxxxxxxxxxxx>
- Date: Sun, 14 May 2006 21:11:42 +0200
When an exception is thrown in a static initializer, it is caught
and wrapped in a TypeInitializationException.
Presently, I track these cases down by catching and rethrowing
the TypeInitializationException; then the debugger gets positioned
where I can examine the exception and peel it to the innermost
exception (often nested in other TypeInitializationExceptions),
then I can set a breakpoint in the offending static initializer and
initialize it.
I just wonder if there is an easier way... can I make the debugger
act as if the original exception was never caught, and take me
straight to the bad line of code?
I'm using VS2005 pro, C#.
Ole N.
.
- Follow-Ups:
- Prev by Date: Project creation failed
- Next by Date: Re: Getting at the source of a nested exception (TypeInitializationException)
- Previous by thread: Project creation failed
- Next by thread: Re: Getting at the source of a nested exception (TypeInitializationException)
- Index(es):
Relevant Pages
|