blob: 9da2854435dca3d31082e7907e39a5507d67841d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*=============================================================================
**
**
**
** Purpose: The exception class to wrap exceptions thrown by
** a type's class initializer (.cctor). This is sufficiently
** distinct from a TypeLoadException, which means we couldn't
** find the type.
**
**
=============================================================================*/
using System;
using System.Runtime.Serialization;
using System.Globalization;
using System.Security.Permissions;
namespace System {
#if FEATURE_SERIALIZATION
[Serializable]
#endif
[System.Runtime.InteropServices.ComVisible(true)]
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);
}
// 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);
}
public TypeInitializationException(String fullTypeName, Exception innerException) : base(Environment.GetResourceString("TypeInitialization_Type", fullTypeName), innerException) {
_typeName = fullTypeName;
SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
}
internal TypeInitializationException(SerializationInfo info, StreamingContext context) : base(info, context) {
_typeName = info.GetString("TypeName");
}
public String TypeName
{
get {
if (_typeName == null) {
return String.Empty;
}
return _typeName;
}
}
[System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
info.AddValue("TypeName",TypeName,typeof(String));
}
}
}
|