AccessViolationException.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: Exception class representing an AV that was deemed unsafe and may have corrupted the application.
  9. **
  10. **
  11. =============================================================================*/
  12. using System;
  13. using System.Runtime.Serialization;
  14. namespace System
  15. {
  16. [Serializable]
  17. [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
  18. public class AccessViolationException : SystemException
  19. {
  20. public AccessViolationException()
  21. : base(SR.Arg_AccessViolationException)
  22. {
  23. HResult = HResults.E_POINTER;
  24. }
  25. public AccessViolationException(string message)
  26. : base(message)
  27. {
  28. HResult = HResults.E_POINTER;
  29. }
  30. public AccessViolationException(string message, Exception innerException)
  31. : base(message, innerException)
  32. {
  33. HResult = HResults.E_POINTER;
  34. }
  35. protected AccessViolationException(SerializationInfo info, StreamingContext context) : base(info, context)
  36. {
  37. }
  38. #pragma warning disable 169 // Field is not used from managed.
  39. private IntPtr _ip; // Address of faulting instruction.
  40. private IntPtr _target; // Address that could not be accessed.
  41. private int _accessType; // 0:read, 1:write
  42. #pragma warning restore 169
  43. }
  44. }