Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / mscorlib / system / reflection / targetinvocationexception.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 ////////////////////////////////////////////////////////////////////////////////
7 ////////////////////////////////////////////////////////////////////////////////
8 //
9 // TargetInvocationException is used to report an exception that was thrown
10 // 
11 // <OWNER>Microsoft</OWNER>
12 //    by the target of an invocation.
13 //
14 // 
15 // 
16 //
17 namespace System.Reflection {
18     
19     
20     using System;
21     using System.Runtime.Serialization;
22     [Serializable]
23 [System.Runtime.InteropServices.ComVisible(true)]
24 #if FEATURE_CORECLR
25     public sealed class TargetInvocationException : Exception {
26 #else
27     public sealed class TargetInvocationException : ApplicationException {
28 #endif //FEATURE_CORECLR
29         // This exception is not creatable without specifying the
30         //    inner exception.
31         private TargetInvocationException()
32             : base(Environment.GetResourceString("Arg_TargetInvocationException")) {
33             SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
34         }
35
36         // This is called from within the runtime.
37         private TargetInvocationException(String message) : base(message) {
38             SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
39         }       
40         
41         public TargetInvocationException(System.Exception inner) 
42             : base(Environment.GetResourceString("Arg_TargetInvocationException"), inner) {
43             SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
44         }
45     
46         public TargetInvocationException(String message, Exception inner) : base(message, inner) {
47             SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
48         }
49
50         internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base (info, context) {
51         }
52     }
53 }