1 <Type Name="TypeInitializationException" FullName="System.TypeInitializationException" FullNameSP="System_TypeInitializationException" Maintainer="ecma">
2 <TypeSignature Language="ILASM" Value=".class public sealed serializable TypeInitializationException extends System.SystemException" />
3 <TypeSignature Language="C#" Value="public sealed class TypeInitializationException : SystemException" />
4 <MemberOfLibrary>BCL</MemberOfLibrary>
6 <AssemblyName>mscorlib</AssemblyName>
7 <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
8 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
9 <AssemblyVersion>2.0.0.0</AssemblyVersion>
10 <AssemblyVersion>4.0.0.0</AssemblyVersion>
12 <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
14 <BaseTypeName>System.SystemException</BaseTypeName>
19 <para> Represents the error that occurs when an exception is thrown inside the
20 static constructor of a type.</para>
23 <para> When a static constructor fails to initialize a type, a
24 <see cref="T:System.TypeInitializationException" /> instance is created and passed a reference to the exception
25 thrown by the static constructor. The <see cref="!:System.TypeInitializationException.InnerException" /> property stores the exception that was thrown
26 by the static constructor.</para>
29 <para>The following example demonstrates an error that causes
30 a <see cref="T:System.TypeInitializationException" /> exception.</para>
31 <code lang="C#">using System;
35 // Throw an application-defined exception.
36 throw new ApplicationException("Error in Class TypeInit");
41 static public void Main() {
43 TypeInit t = new TypeInit ();
45 catch (TypeInitializationException e) {
46 Console.WriteLine("Error: {0}",e);
51 <para>The output is</para>
53 Error: System.TypeInitializationException: The type initializer for "TypeInit" threw an exception. ---> System.ApplicationException: Error in Class TypeInit
55 --- End of inner exception stack trace ---
57 at TestTypeInit.Main()
62 <Member MemberName=".ctor">
63 <MemberSignature Language="C#" Value="public TypeInitializationException (string fullTypeName, Exception innerException);" />
64 <MemberType>Constructor</MemberType>
66 <Parameter Name="fullTypeName" Type="System.String" />
67 <Parameter Name="innerException" Type="System.Exception" />
70 <param name="fullTypeName">To be added.</param>
71 <param name="innerException">To be added.</param>
72 <summary>To be added.</summary>
73 <remarks>To be added.</remarks>
76 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
77 <AssemblyVersion>2.0.0.0</AssemblyVersion>
78 <AssemblyVersion>4.0.0.0</AssemblyVersion>
81 <Member MemberName="GetObjectData">
82 <MemberSignature Language="C#" Value="public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
83 <MemberType>Method</MemberType>
85 <ReturnType>System.Void</ReturnType>
88 <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
89 <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
92 <param name="info">To be added.</param>
93 <param name="context">To be added.</param>
94 <summary>To be added.</summary>
95 <remarks>To be added.</remarks>
98 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
99 <AssemblyVersion>2.0.0.0</AssemblyVersion>
100 <AssemblyVersion>4.0.0.0</AssemblyVersion>
103 <Member MemberName="TypeName">
104 <MemberSignature Language="ILASM" Value=".property string TypeName { public hidebysig specialname instance string get_TypeName() }" />
105 <MemberSignature Language="C#" Value="public string TypeName { get; }" />
106 <MemberType>Property</MemberType>
108 <ReturnType>System.String</ReturnType>
113 <para> Gets the fully qualified name of the type that causes the
117 <para>A <see cref="T:System.String" /> that contains the fully qualified name of the type that caused the exception.</para>
120 <para>This property is read-only.</para>
121 <para>The <see cref="P:System.TypeInitializationException.TypeName" /> property returns the same value as was
122 passed into the constructor.</para>
125 <Excluded>0</Excluded>
127 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
128 <AssemblyVersion>2.0.0.0</AssemblyVersion>
129 <AssemblyVersion>4.0.0.0</AssemblyVersion>
133 <TypeExcluded>0</TypeExcluded>
136 <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>