How to debug "The type initializer for 'my class' threw an exception"
Posted
by
JFB
on Stack Overflow
See other posts from Stack Overflow
or by JFB
Published on 2012-09-06T17:48:05Z
Indexed on
2013/10/26
3:55 UTC
Read the original article
Hit count: 223
I am getting the exception: The type initializer for 'my class' threw an exception.
in my browser after running my web application. Since this seems to be an error message generated from the view (.aspx), there is no way I can see the stack trace or any log for the source of this error.
I have read a bit around the net and one solution to debugging is to throw a TypeInitializationException
and then looking at the inner exception to find out what was wrong. How can I do this when I don't know where to surround code with a try/catch ?
© Stack Overflow or respective owner