﻿<?xml version="1.0" encoding="utf-8"?><Type Name="AccessViolationException" FullName="System.AccessViolationException"><TypeSignature Language="C#" Value="public class AccessViolationException : SystemException" /><TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit AccessViolationException extends System.SystemException" /><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>System.SystemException</BaseTypeName></Base><Interfaces /><Attributes><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>An access violation occurs in unmanaged or unsafe code when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors. An <see cref="T:System.AccessViolationException" /> clearly identifies these serious errors.</para><para>In programs consisting entirely of verifiable managed code, all references are either valid or null, and access violations are impossible. An <see cref="T:System.AccessViolationException" /> occurs only when verifiable managed code interacts with unmanaged code or with unsafe managed code.</para><para>Starting with the net_v40_long, <see cref="T:System.AccessViolationException" /> exceptions thrown by the common language runtime are not handled by the catch statement in a structured exception handler if the exception occurs outside of the memory reserved by the common language runtime. To handle such an <see cref="T:System.AccessViolationException" /> exception, you should apply the  <see cref="T:System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute" /> attribute to the method in which the exception is thrown. This change does not affect <see cref="T:System.AccessViolationException" /> exceptions thrown by user code, which can continue to be caught by a catch statement. For code written for previous versions of the .NET Framework that you want to recompile and run without modification on the net_v40_long, you can add the <format type="text/html"><a href="e0a55ddc-bfa8-4f3e-ac14-d1fc3330e4bb">&lt;legacyCorruptedStateExceptionsPolicy&gt;</a></format> element to your app's configuration file. Note that you can also receive notification of the exceptions if you have defined a handler for the <see cref="E:System.AppDomain.FirstChanceException" /> or <see cref="E:System.AppDomain.UnhandledException" /> event. </para><format type="text/html"><h2>Version Information</h2></format><para>This exception is thrown in the .NET Framework 2.0 and later versions. In earlier versions of the .NET Framework, an access violation in unmanaged code or unsafe managed code is represented by a <see cref="T:System.NullReferenceException" /> in managed code. A <see cref="T:System.NullReferenceException" /> is also thrown when a null reference is dereferenced in verifiable managed code, an occurrence that does not involve data corruption, and there is no way to distinguish between the two situations in versions 1.0 or 1.1.</para><para>Administrators can allow selected applications to revert to the behavior of the .NET Framework version 1.1. Place the following line in the <format type="text/html"><a href="1eb2fae3-de4b-45b6-852f-517c39b751bd">&lt;runtime&gt; Element</a></format> section of the configuration file for the application:</para><code>&lt;legacyNullReferenceExceptionPolicy enabled = "1"/&gt;</code></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>The exception that is thrown when there is an attempt to read or write protected memory.</para></summary></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public AccessViolationException ();" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Parameters /><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>This constructor initializes the <see cref="P:System.Exception.Message" /> property of the new instance to a system-supplied message that describes the error, such as "Attempted to read or write protected memory. This is often an indication that other memory has been corrupted." This message takes into account the current system culture.</para><para>The following table shows the initial property values for an instance of <see cref="T:System.AccessViolationException" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.Exception.InnerException" /></para></term><description><para>null. </para></description></item><item><term><para><see cref="P:System.Exception.Message" /></para></term><description><para>The localized error message string. </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.AccessViolationException" /> class with a system-supplied message that describes the error.</para></summary></Docs></Member><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public AccessViolationException (string message);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Parameters><Parameter Name="message" Type="System.String" /></Parameters><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The following table shows the initial property values for an instance of <see cref="T:System.AccessViolationException" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.Exception.InnerException" /></para></term><description><para>null. </para></description></item><item><term><para><see cref="P:System.Exception.Message" /></para></term><description><para>The error message string specified in <paramref name="message" />. </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.AccessViolationException" /> class with a specified message that describes the error.</para></summary><param name="message"><attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param></Docs></Member><Member MemberName=".ctor"><MemberSignature Language="C#" Value="protected AccessViolationException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /><MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Parameters><Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /><Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" /></Parameters><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. For more information, see <format type="text/html"><a href="832ac524-21bc-419a-a27b-ca8bfc45840f">XML and Soap Serialization</a></format>.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.AccessViolationException" /> class with serialized data.</para></summary><param name="info"><attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data. </param><param name="context"><attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param></Docs></Member><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public AccessViolationException (string message, Exception innerException);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, class System.Exception innerException) cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><Parameters><Parameter Name="message" Type="System.String" /><Parameter Name="innerException" Type="System.Exception" /></Parameters><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the <see cref="P:System.Exception.InnerException" /> property. The <see cref="P:System.Exception.InnerException" /> property returns the same value that is passed into the constructor, or null if the <see cref="P:System.Exception.InnerException" /> property does not supply the inner exception value to the constructor.</para><para>The following table shows the initial property values for an instance of <see cref="T:System.AccessViolationException" />.</para><list type="table"><listheader><item><term><para>Property </para></term><description><para>Value </para></description></item></listheader><item><term><para><see cref="P:System.Exception.InnerException" /></para></term><description><para>null. </para></description></item><item><term><para><see cref="P:System.Exception.Message" /></para></term><description><para>The error message string specified in <paramref name="message" />. </para></description></item></list></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.AccessViolationException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</para></summary><param name="message"><attribution license="cc4" from="Microsoft" modified="false" />The message that describes the exception. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param><param name="innerException"><attribution license="cc4" from="Microsoft" modified="false" />The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param></Docs></Member></Members></Type>