Fix null sessions in HttpContextWrapper.Session
[mono.git] / mcs / class / corlib / Documentation / en / System / MethodAccessException.xml
1 <Type Name="MethodAccessException" FullName="System.MethodAccessException" FullNameSP="System_MethodAccessException" Maintainer="ecma">
2   <TypeSignature Language="ILASM" Value=".class public serializable MethodAccessException extends System.MemberAccessException" />
3   <TypeSignature Language="C#" Value="public class MethodAccessException : MemberAccessException" />
4   <MemberOfLibrary>RuntimeInfrastructure</MemberOfLibrary>
5   <AssemblyInfo>
6     <AssemblyName>mscorlib</AssemblyName>
7     <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
8     <AssemblyVersion>1.0.5000.0</AssemblyVersion>
9     <AssemblyVersion>2.0.0.0</AssemblyVersion>
10     <AssemblyVersion>4.0.0.0</AssemblyVersion>
11   </AssemblyInfo>
12   <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
13   <Base>
14     <BaseTypeName>System.MemberAccessException</BaseTypeName>
15   </Base>
16   <Interfaces />
17   <Docs>
18     <summary>
19       <para>Represents the error that occurs when there is an
20       attempt to access a method outside the scope in which access is permitted.</para>
21     </summary>
22     <remarks>
23       <para>
24         <block subset="none" type="note">This exception is
25       thrown when the access level of a method in a class library is changed, and one
26       or more assemblies referencing the library have not been recompiled. This exception is also thrown when an attempt to invoke a
27       method via reflection fails because the caller does not have the required
28       permissions.</block>
29       </para>
30     </remarks>
31     <example>
32       <para>The following example demonstrates a scenario under
33       which <see cref="T:System.MethodAccessException" />
34       is thrown.</para>
35       <para>The following code contains a class with a public method (MyMethod). This
36       class is compiled into a class library.</para>
37       <code lang="C#">using System;
38 namespace TestNameSpace 
39 {
40  public class Class1
41  {
42    public Class1()
43    {
44      Console.WriteLine ("Constructing with public method.");
45    }
46    public void MyMethod () 
47    {
48      Console.WriteLine ("Calling MyMethod.");
49    }
50  }
51 }
52       </code>
53       <para>The following code references the class library above, and accesses
54       TestNameSpace.Class1.MyMethod. This code is compiled into an application.</para>
55       <code lang="C#">using System;
56 using TestNameSpace;
57 class AppTest
58 {
59  public static void Main()
60  {
61    Class1 test = new Class1();
62    test.MyMethod();
63  }
64 }
65       </code>
66       <para>The output of the application is</para>
67       <c>
68         <para>Constructing with public method.</para>
69         <para>Calling MyMethod.</para>
70       </c>
71       <para>The code for the class library is changed and recompiled so that TestNameSpace.Class1.MyMethod is no longer public. The following code changes
72       MyMethod from public to private. </para>
73       <code lang="C#">using System;
74 namespace TestNameSpace 
75 {
76  public class Class1
77  {
78    public Class1()
79    {
80      Console.WriteLine ("Constructing with private method.");
81    }
82    private void MyMethod () 
83    {
84      Console.WriteLine ("Calling MyMethod.");
85    }
86  }
87 }
88       </code>
89       <para>When the application is executed again without being recompiled, the output
90       is</para>
91       <c>
92         <para>Unhandled Exception: System.MethodAccessException:
93          TestNameSpace.Class1.MyMethod()</para>
94         <para> at AppTest.Main()</para>
95       </c>
96     </example>
97   </Docs>
98   <Members>
99     <Member MemberName=".ctor">
100       <MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor()" />
101       <MemberSignature Language="C#" Value="public MethodAccessException ();" />
102       <MemberType>Constructor</MemberType>
103       <ReturnValue />
104       <Parameters />
105       <Docs>
106         <summary>
107           <para>Constructs and initializes a new instance of the
108    <see cref="T:System.MethodAccessException" />
109    class.</para>
110         </summary>
111         <remarks>
112           <para>This constructor initializes the <see cref="!:System.MethodAccessException.Message" />
113 property of the new instance to a system-supplied message that describes the
114 error, such as "Attempt to access the method failed." This message takes into
115 account the current system culture.</para>
116           <para>The <see cref="!:System.MethodAccessException.InnerException" /> property of the new instance is
117 initialized to <see langword="null" /> .</para>
118         </remarks>
119       </Docs>
120       <Excluded>0</Excluded>
121       <AssemblyInfo>
122         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
123         <AssemblyVersion>2.0.0.0</AssemblyVersion>
124         <AssemblyVersion>4.0.0.0</AssemblyVersion>
125       </AssemblyInfo>
126     </Member>
127     <Member MemberName=".ctor">
128       <MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(string message)" />
129       <MemberSignature Language="C#" Value="public MethodAccessException (string message);" />
130       <MemberType>Constructor</MemberType>
131       <ReturnValue />
132       <Parameters>
133         <Parameter Name="message" Type="System.String" />
134       </Parameters>
135       <Docs>
136         <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param>
137         <summary>
138           <para>Constructs and initializes a new instance of the <see cref="T:System.MethodAccessException" /> class with
139    a specified error message.</para>
140         </summary>
141         <remarks>
142           <para>This constructor initializes the <see cref="!:System.MethodAccessException.Message" />
143 property of the new instance using <paramref name="message" />. If <paramref name="message" /> is
144 <see langword="null" />, the <see cref="!:System.MethodAccessException.Message" /> property is initialized to the 
145 system-supplied message provided by the constructor that takes no
146 arguments. </para>
147           <para> The <see cref="!:System.MethodAccessException.InnerException" /> property of the
148 new instance is initialized to <see langword="null" />.</para>
149         </remarks>
150       </Docs>
151       <Excluded>0</Excluded>
152       <AssemblyInfo>
153         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
154         <AssemblyVersion>2.0.0.0</AssemblyVersion>
155         <AssemblyVersion>4.0.0.0</AssemblyVersion>
156       </AssemblyInfo>
157     </Member>
158     <Member MemberName=".ctor">
159       <MemberSignature Language="C#" Value="protected MethodAccessException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" />
160       <MemberType>Constructor</MemberType>
161       <Parameters>
162         <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" />
163         <Parameter Name="context" Type="System.Runtime.Serialization.StreamingContext" />
164       </Parameters>
165       <Docs>
166         <param name="info">To be added.</param>
167         <param name="context">To be added.</param>
168         <summary>To be added.</summary>
169         <remarks>To be added.</remarks>
170       </Docs>
171       <AssemblyInfo>
172         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
173         <AssemblyVersion>2.0.0.0</AssemblyVersion>
174         <AssemblyVersion>4.0.0.0</AssemblyVersion>
175       </AssemblyInfo>
176     </Member>
177     <Member MemberName=".ctor">
178       <MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(string message, class System.Exception inner)" />
179       <MemberSignature Language="C#" Value="public MethodAccessException (string message, Exception inner);" />
180       <MemberType>Constructor</MemberType>
181       <ReturnValue />
182       <Parameters>
183         <Parameter Name="message" Type="System.String" />
184         <Parameter Name="inner" Type="System.Exception" />
185       </Parameters>
186       <Docs>
187         <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param>
188         <param name="inner">An instance of <see cref="T:System.Exception" /> that is the cause of the current exception. If <paramref name="inner" /> is not a <see langword="null" /> reference, the current exception was raised in a catch block handling <paramref name="inner" /> .</param>
189         <summary>
190           <para>Constructs and initializes a new instance of the <see cref="T:System.MethodAccessException" /> class with a specified error
191    message and a reference to the inner exception that is the cause of the current
192    exception.</para>
193         </summary>
194         <remarks>
195           <para>This constructor initializes the <see cref="!:System.MethodAccessException.Message" /> property of the new instance
196    using <paramref name="message" /> and the <see cref="!:System.MethodAccessException.InnerException" /> property using
197 <paramref name="inner" />. If <paramref name="message" /> is <see langword="null" />, 
198    the <see cref="!:System.MethodAccessException.Message" /> property is initialized to the system-supplied message
199    provided by the constructor that takes no arguments.</para>
200           <block subset="none" type="note">For more information on inner
201    exceptions, see <see cref="P:System.Exception.InnerException" />.</block>
202         </remarks>
203       </Docs>
204       <Excluded>0</Excluded>
205       <AssemblyInfo>
206         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
207         <AssemblyVersion>2.0.0.0</AssemblyVersion>
208         <AssemblyVersion>4.0.0.0</AssemblyVersion>
209       </AssemblyInfo>
210     </Member>
211   </Members>
212   <TypeExcluded>0</TypeExcluded>
213   <Attributes>
214     <Attribute>
215       <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
216     </Attribute>
217   </Attributes>
218 </Type>