-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
ApplicationActivator.xml
218 lines (193 loc) · 16.1 KB
/
ApplicationActivator.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<Type Name="ApplicationActivator" FullName="System.Runtime.Hosting.ApplicationActivator">
<TypeSignature Language="C#" Value="public class ApplicationActivator" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ApplicationActivator extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.Runtime.Hosting.ApplicationActivator" />
<TypeSignature Language="VB.NET" Value="Public Class ApplicationActivator" />
<TypeSignature Language="F#" Value="type ApplicationActivator = class" />
<TypeSignature Language="C++ CLI" Value="public ref class ApplicationActivator" />
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Runtime.InteropServices.ComVisible(true)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.InteropServices.ComVisible(true)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides the base class for the activation of manifest-based assemblies.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
There is a single designated instance of the <xref:System.Runtime.Hosting.ApplicationActivator> class in each <xref:System.AppDomain> to which all activation calls are routed. The <xref:System.AppDomainManager> for the current <xref:System.AppDomain> can provide its own custom <xref:System.Runtime.Hosting.ApplicationActivator> for this purpose. If a custom <xref:System.Runtime.Hosting.ApplicationActivator> is not provided, an instance of the default <xref:System.Runtime.Hosting.ApplicationActivator> is created.
The following steps describe the behavior of the default <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstance%2A> method implementation:
1. Checks if the <xref:System.ActivationContext> of the add-in to be activated matches the <xref:System.ActivationContext> of the current domain; if not, proceeds to step 2. Otherwise, executes the assembly and returns the result wrapped in an object handle.
2. Activates the add-in in a new <xref:System.AppDomain>. The following steps are taken to initialize a new <xref:System.AppDomain> using the <xref:System.Runtime.Hosting.ActivationArguments> for the add-in.
1. Creates a new <xref:System.AppDomainSetup> object using an <xref:System.Runtime.Hosting.ActivationArguments> object containing the activation context for the add-in.
2. Calls the <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper%2A> method to create a new domain using the <xref:System.AppDomainSetup> object.
3. The <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper%2A> method calls the <xref:System.Security.HostSecurityManager.DetermineApplicationTrust%2A?displayProperty=nameWithType> method to acquire an <xref:System.Security.Policy.ApplicationTrust> object for the add-in. If the <xref:System.Security.Policy.ApplicationTrust.IsApplicationTrustedToRun%2A> property returns `true`, the add-in is executed. If not, <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper%2A> throws a <xref:System.Security.Policy.PolicyException> indicating that execution permission could not be acquired.
4. If the add-in is trusted to run, then a new <xref:System.AppDomain> is created and configured for the <xref:System.ActivationContext> of the add-in, and the add-in is loaded and executed.
5. The result of the activation of the add-in is returned, wrapped in an object handle.
A custom activator can tailor the activation of an add-in to a particular set of circumstances. For example, a custom activator could find an existing <xref:System.AppDomain> to activate this add-in instead of creating a new domain every time.
The following steps describe the behavior of a custom <xref:System.Runtime.Hosting.ApplicationActivator> that activates an add-in in an existing <xref:System.AppDomain>:
1. The custom activator finds a domain that has the same <xref:System.ActivationContext> as the add-in that is being activated.
2. If the <xref:System.ActivationContext> has never been seen before in the process, the custom activator creates a new <xref:System.AppDomain> for this <xref:System.ActivationContext> by calling the <xref:System.AppDomain.CreateDomain%2A> method directly, or delegating this activity to the <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper%2A> in the base class.
3. If there is an existing domain with the same <xref:System.ActivationContext>, then the activator can delegate the <xref:System.Runtime.Hosting.ApplicationActivator.CreateInstance%2A> method call to the <xref:System.Runtime.Hosting.ApplicationActivator> in the target domain. Note that this would be a cross-domain call to an <xref:System.Runtime.Hosting.ApplicationActivator> that resides in the target <xref:System.AppDomain>.
## Examples
The following code example shows how to obtain an <xref:System.Runtime.Hosting.ApplicationActivator> object from the current <xref:System.AppDomain.DomainManager%2A> for a manifest-based application.
:::code language="csharp" source="~/snippets/csharp/System.Runtime.Hosting/ActivationArguments/Overview/program.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Runtime.Hosting.ApplicationActivator/vb/program.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ApplicationActivator ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.Hosting.ApplicationActivator.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 ApplicationActivator();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Runtime.Hosting.ApplicationActivator" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<MemberGroup MemberName="CreateInstance">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Creates an instance of the application to be activated, using an activation context that identifies the application.</summary>
</Docs>
</MemberGroup>
<Member MemberName="CreateInstance">
<MemberSignature Language="C#" Value="public virtual System.Runtime.Remoting.ObjectHandle CreateInstance (ActivationContext activationContext);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Runtime.Remoting.ObjectHandle CreateInstance(class System.ActivationContext activationContext) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateInstance (activationContext As ActivationContext) As ObjectHandle" />
<MemberSignature Language="F#" Value="abstract member CreateInstance : ActivationContext -> System.Runtime.Remoting.ObjectHandle
override this.CreateInstance : ActivationContext -> System.Runtime.Remoting.ObjectHandle" Usage="applicationActivator.CreateInstance activationContext" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Runtime::Remoting::ObjectHandle ^ CreateInstance(ActivationContext ^ activationContext);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Runtime.Remoting.ObjectHandle</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="activationContext" Type="System.ActivationContext" />
</Parameters>
<Docs>
<param name="activationContext">An <see cref="T:System.ActivationContext" /> that identifies the application to activate.</param>
<summary>Creates an instance of the application to be activated, using the specified activation context.</summary>
<returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is intended for the manifest-based activation of applications.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="activationContext" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="CreateInstance">
<MemberSignature Language="C#" Value="public virtual System.Runtime.Remoting.ObjectHandle CreateInstance (ActivationContext activationContext, string[] activationCustomData);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Runtime.Remoting.ObjectHandle CreateInstance(class System.ActivationContext activationContext, string[] activationCustomData) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext,System.String[])" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function CreateInstance (activationContext As ActivationContext, activationCustomData As String()) As ObjectHandle" />
<MemberSignature Language="F#" Value="abstract member CreateInstance : ActivationContext * string[] -> System.Runtime.Remoting.ObjectHandle
override this.CreateInstance : ActivationContext * string[] -> System.Runtime.Remoting.ObjectHandle" Usage="applicationActivator.CreateInstance (activationContext, activationCustomData)" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Runtime::Remoting::ObjectHandle ^ CreateInstance(ActivationContext ^ activationContext, cli::array <System::String ^> ^ activationCustomData);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Runtime.Remoting.ObjectHandle</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="activationContext" Type="System.ActivationContext" />
<Parameter Name="activationCustomData" Type="System.String[]" />
</Parameters>
<Docs>
<param name="activationContext">An <see cref="T:System.ActivationContext" /> that identifies the application to activate.</param>
<param name="activationCustomData">Custom activation data.</param>
<summary>Creates an instance of the application to be activated, using the specified activation context and custom activation data.</summary>
<returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is intended for the manifest-based activation of applications. The activation data consists of information such as the query string portion of a URL.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="activationContext" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="CreateInstanceHelper">
<MemberSignature Language="C#" Value="protected static System.Runtime.Remoting.ObjectHandle CreateInstanceHelper (AppDomainSetup adSetup);" />
<MemberSignature Language="ILAsm" Value=".method familystatic hidebysig class System.Runtime.Remoting.ObjectHandle CreateInstanceHelper(class System.AppDomainSetup adSetup) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper(System.AppDomainSetup)" />
<MemberSignature Language="VB.NET" Value="Protected Shared Function CreateInstanceHelper (adSetup As AppDomainSetup) As ObjectHandle" />
<MemberSignature Language="F#" Value="static member CreateInstanceHelper : AppDomainSetup -> System.Runtime.Remoting.ObjectHandle" Usage="System.Runtime.Hosting.ApplicationActivator.CreateInstanceHelper adSetup" />
<MemberSignature Language="C++ CLI" Value="protected:
 static System::Runtime::Remoting::ObjectHandle ^ CreateInstanceHelper(AppDomainSetup ^ adSetup);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Security.SecuritySafeCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecuritySafeCritical>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Runtime.Remoting.ObjectHandle</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="adSetup" Type="System.AppDomainSetup" />
</Parameters>
<Docs>
<param name="adSetup">An <see cref="T:System.AppDomainSetup" /> object whose <see cref="P:System.AppDomainSetup.ActivationArguments" /> property identifies the application to activate.</param>
<summary>Creates an instance of an application using the specified <see cref="T:System.AppDomainSetup" /> object.</summary>
<returns>An <see cref="T:System.Runtime.Remoting.ObjectHandle" /> that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is intended for the manifest-based activation of applications.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.AppDomainSetup.ActivationArguments" /> property of <paramref name="adSetup" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.Policy.PolicyException">The application instance failed to execute because the policy settings on the current application domain do not provide permission for this application to run.</exception>
</Docs>
</Member>
</Members>
</Type>