Initial commit
[mono.git] / mcs / class / referencesource / mscorlib / system / missingmethodexception.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 /*=============================================================================
7 **
8 ** Class: MissingMethodException
9 **
10 **
11 ** Purpose: The exception class for class loading failures.
12 **
13 **
14 =============================================================================*/
15
16 namespace System {
17     
18     using System;
19     using System.Runtime.Remoting;
20     using System.Runtime.Serialization;
21     using System.Runtime.CompilerServices;
22     using System.Globalization;
23 [System.Runtime.InteropServices.ComVisible(true)]
24     [Serializable]
25     public class MissingMethodException : MissingMemberException, ISerializable {
26         public MissingMethodException() 
27             : base(Environment.GetResourceString("Arg_MissingMethodException")) {
28             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
29         }
30     
31         public MissingMethodException(String message) 
32             : base(message) {
33             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
34         }
35     
36         public MissingMethodException(String message, Exception inner) 
37             : base(message, inner) {
38             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
39         }
40
41         protected MissingMethodException(SerializationInfo info, StreamingContext context) : base(info, context) {
42         }
43     
44         public override String Message
45         {
46             [System.Security.SecuritySafeCritical]  // auto-generated
47             get {
48                 if (ClassName == null) {
49                     return base.Message;
50                 } else {
51                     // do any desired fixups to classname here.
52                     return Environment.GetResourceString("MissingMethod_Name",
53                                                                        ClassName + "." + MemberName +
54                                                                        (Signature != null ? " " + FormatSignature(Signature) : ""));
55                 }
56             }
57         }
58     
59         // Called from the EE
60         private MissingMethodException(String className, String methodName, byte[] signature)
61         {
62             ClassName   = className;
63             MemberName  = methodName;
64             Signature   = signature;
65         }
66     
67         public MissingMethodException(String className, String methodName)
68         {
69             ClassName   = className;
70             MemberName  = methodName;
71         }
72     
73         // If ClassName != null, Message will construct on the fly using it
74         // and the other variables. This allows customization of the
75         // format depending on the language environment.
76     }
77 }