MissingMethodException.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. /*=============================================================================
  5. **
  6. **
  7. **
  8. ** Purpose: The exception class for class loading failures.
  9. **
  10. **
  11. =============================================================================*/
  12. using System.Runtime.Serialization;
  13. namespace System
  14. {
  15. [Serializable]
  16. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  17. public class MissingMethodException : MissingMemberException
  18. {
  19. public MissingMethodException()
  20. : base(SR.Arg_MissingMethodException)
  21. {
  22. HResult = HResults.COR_E_MISSINGMETHOD;
  23. }
  24. public MissingMethodException(string message)
  25. : base(message)
  26. {
  27. HResult = HResults.COR_E_MISSINGMETHOD;
  28. }
  29. public MissingMethodException(string message, Exception inner)
  30. : base(message, inner)
  31. {
  32. HResult = HResults.COR_E_MISSINGMETHOD;
  33. }
  34. public MissingMethodException(string className, string methodName)
  35. {
  36. ClassName = className;
  37. MemberName = methodName;
  38. }
  39. protected MissingMethodException(SerializationInfo info, StreamingContext context)
  40. : base(info, context)
  41. {
  42. }
  43. public override string Message
  44. {
  45. get
  46. {
  47. return ClassName == null ? base.Message :
  48. SR.Format(SR.MissingMethod_Name, ClassName + "." + MemberName +
  49. (Signature != null ? " " + FormatSignature(Signature) : string.Empty));
  50. }
  51. }
  52. }
  53. }