The Labs \ Source Viewer \ SSCLI \ System \ MissingMethodException

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*=============================================================================
  16. **
  17. ** Class: MissingMethodException
  18. **
  19. **
  20. ** Purpose: The exception class for class loading failures.
  21. **
  22. **
  23. =============================================================================*/
  24. namespace System
  25. {
  26.    
  27.     using System;
  28.     using System.Runtime.Remoting;
  29.     using System.Runtime.Serialization;
  30.     using System.Runtime.CompilerServices;
  31.     using System.Globalization;
  32.     [System.Runtime.InteropServices.ComVisible(true)]
  33.     [Serializable()]
  34.     public class MissingMethodException : MissingMemberException, ISerializable
  35.     {
  36.         public MissingMethodException() : base(Environment.GetResourceString("Arg_MissingMethodException"))
  37.         {
  38.             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
  39.         }
  40.        
  41.         public MissingMethodException(string message) : base(message)
  42.         {
  43.             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
  44.         }
  45.        
  46.         public MissingMethodException(string message, Exception inner) : base(message, inner)
  47.         {
  48.             SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
  49.         }
  50.        
  51.         protected MissingMethodException(SerializationInfo info, StreamingContext context) : base(info, context)
  52.         {
  53.         }
  54.        
  55.         public override string Message {
  56.             get {
  57.                 if (ClassName == null) {
  58.                     return base.Message;
  59.                 }
  60.                 else {
  61.                     // do any desired fixups to classname here.
  62.                     return String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("MissingMethod_Name", ClassName + "." + MemberName + (Signature != null ? " " + FormatSignature(Signature) : "")));
  63.                 }
  64.             }
  65.         }
  66.        
  67.         // Called from the EE
  68.         private MissingMethodException(string className, string methodName, byte[] signature)
  69.         {
  70.             ClassName = className;
  71.             MemberName = methodName;
  72.             Signature = signature;
  73.         }
  74.        
  75.         public MissingMethodException(string className, string methodName)
  76.         {
  77.             ClassName = className;
  78.             MemberName = methodName;
  79.         }
  80.        
  81.         // If ClassName != null, Message will construct on the fly using it
  82.         // and the other variables. This allows customization of the
  83.         // format depending on the language environment.
  84.     }
  85. }

Developer Fusion