The Labs \ Source Viewer \ SSCLI \ System \ MissingFieldException

  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: MissingFieldException
  18. **
  19. ** Purpose: The exception class for class loading failures.
  20. **
  21. =============================================================================*/
  22. namespace System
  23. {
  24.    
  25.     using System;
  26.     using System.Runtime.Remoting;
  27.     using System.Runtime.Serialization;
  28.     using System.Runtime.CompilerServices;
  29.     using System.Globalization;
  30.     [System.Runtime.InteropServices.ComVisible(true)]
  31.     [Serializable()]
  32.     public class MissingFieldException : MissingMemberException, ISerializable
  33.     {
  34.         public MissingFieldException() : base(Environment.GetResourceString("Arg_MissingFieldException"))
  35.         {
  36.             SetErrorCode(__HResults.COR_E_MISSINGFIELD);
  37.         }
  38.        
  39.         public MissingFieldException(string message) : base(message)
  40.         {
  41.             SetErrorCode(__HResults.COR_E_MISSINGFIELD);
  42.         }
  43.        
  44.         public MissingFieldException(string message, Exception inner) : base(message, inner)
  45.         {
  46.             SetErrorCode(__HResults.COR_E_MISSINGFIELD);
  47.         }
  48.        
  49.         protected MissingFieldException(SerializationInfo info, StreamingContext context) : base(info, context)
  50.         {
  51.         }
  52.        
  53.         public override string Message {
  54.             get {
  55.                 if (ClassName == null) {
  56.                     return base.Message;
  57.                 }
  58.                 else {
  59.                     // do any desired fixups to classname here.
  60.                     return String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("MissingField_Name", (Signature != null ? FormatSignature(Signature) + " " : "") + ClassName + "." + MemberName));
  61.                 }
  62.             }
  63.         }
  64.        
  65.         // Called from the EE
  66.         private MissingFieldException(string className, string fieldName, byte[] signature)
  67.         {
  68.             ClassName = className;
  69.             MemberName = fieldName;
  70.             Signature = signature;
  71.         }
  72.        
  73.         public MissingFieldException(string className, string fieldName)
  74.         {
  75.             ClassName = className;
  76.             MemberName = fieldName;
  77.         }
  78.        
  79.         // If ClassName != null, Message will construct on the fly using it
  80.         // and the other variables. This allows customization of the
  81.         // format depending on the language environment.
  82.     }
  83. }

Developer Fusion