An unhandled exception of type 'System.TypeInitializationException' in .Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    An unhandled exception of type 'System.TypeInitializationException' in .Net

    Hi all,
    I am getting the error "The type initializer for "MyExeName.Libr aryName" threw an exception."
    where liraryName Class have the Static constructor and the private constructor.I had a little quest over this and observed that the exception occurs
    When a class initializer fails to initialize a type . I also observed that it occurs mostly with the static constructors.
    Could anyone help me to resolve this issue ?

    Thanks
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Well static objects do not HAVE constructors, so that could be one failure.

    [quote=msdn]
    When a class initializer fails to initialize a type, a TypeInitializat ionException is created and passed a reference to the exception thrown by the type's class initializer. The InnerException property of TypeInitializat ionException holds the underlying exception.
    [/code]
    Check the innerexception property?

    Comment

    Working...