summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/TypeInitializationException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/TypeInitializationException.cs')
-rw-r--r--src/mscorlib/src/System/TypeInitializationException.cs58
1 files changed, 36 insertions, 22 deletions
diff --git a/src/mscorlib/src/System/TypeInitializationException.cs b/src/mscorlib/src/System/TypeInitializationException.cs
index bcc1c3e968..9191028346 100644
--- a/src/mscorlib/src/System/TypeInitializationException.cs
+++ b/src/mscorlib/src/System/TypeInitializationException.cs
@@ -13,53 +13,67 @@
**
**
=============================================================================*/
-using System;
-using System.Runtime.Serialization;
+
using System.Globalization;
-using System.Security.Permissions;
+using System.Runtime.Serialization;
-namespace System {
+namespace System
+{
[Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
- public sealed class TypeInitializationException : SystemException {
+ public sealed class TypeInitializationException : SystemException
+ {
private String _typeName;
// This exception is not creatable without specifying the
// inner exception.
private TypeInitializationException()
- : base(Environment.GetResourceString("TypeInitialization_Default")) {
- SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
+ : base(SR.TypeInitialization_Default)
+ {
+ HResult = __HResults.COR_E_TYPEINITIALIZATION;
+ }
+
+
+ public TypeInitializationException(String fullTypeName, Exception innerException)
+ : this(fullTypeName, SR.Format(SR.TypeInitialization_Type, fullTypeName), innerException)
+ {
}
// This is called from within the runtime. I believe this is necessary
// for Interop only, though it's not particularly useful.
- private TypeInitializationException(String message) : base(message) {
- SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
+ internal TypeInitializationException(String message) : base(message)
+ {
+ HResult = __HResults.COR_E_TYPEINITIALIZATION;
}
-
- public TypeInitializationException(String fullTypeName, Exception innerException) : base(Environment.GetResourceString("TypeInitialization_Type", fullTypeName), innerException) {
+
+ internal TypeInitializationException(String fullTypeName, String message, Exception innerException)
+ : base(message, innerException)
+ {
_typeName = fullTypeName;
- SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
+ HResult = __HResults.COR_E_TYPEINITIALIZATION;
}
- internal TypeInitializationException(SerializationInfo info, StreamingContext context) : base(info, context) {
+ internal TypeInitializationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
_typeName = info.GetString("TypeName");
}
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("TypeName", TypeName, typeof(String));
+ }
+
public String TypeName
{
- get {
- if (_typeName == null) {
+ get
+ {
+ if (_typeName == null)
+ {
return String.Empty;
}
return _typeName;
}
}
-
- public override void GetObjectData(SerializationInfo info, StreamingContext context) {
- base.GetObjectData(info, context);
- info.AddValue("TypeName",TypeName,typeof(String));
- }
-
}
}