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
|
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
using System.Diagnostics.Contracts;
using System.Runtime.Versioning;
using System.Security.Policy;
namespace System.Runtime.Hosting {
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ActivationArguments : EvidenceBase {
private ActivationArguments () {}
// This boolean is used to smuggle the information about whether
// AppDomainSetup was constructed from an ActivationContext.
private bool m_useFusionActivationContext = false;
internal bool UseFusionActivationContext {
get {
return m_useFusionActivationContext;
}
}
// This is used to indicate whether the instance is to be activated
// during the new domain's initialization. CreateInstanceHelper sets
// this flag to true; CreateDomainHelper never activates the application.
private bool m_activateInstance = false;
internal bool ActivateInstance {
get {
return m_activateInstance;
}
set {
m_activateInstance = value;
}
}
private string m_appFullName;
internal string ApplicationFullName {
get {
return m_appFullName;
}
}
private string[] m_appManifestPaths;
internal string[] ApplicationManifestPaths {
get {
return m_appManifestPaths;
}
}
#if !FEATURE_PAL
public ActivationArguments (ApplicationIdentity applicationIdentity) : this (applicationIdentity, null) {}
public ActivationArguments (ApplicationIdentity applicationIdentity, string[] activationData) {
if (applicationIdentity == null)
throw new ArgumentNullException("applicationIdentity");
Contract.EndContractBlock();
m_appFullName = applicationIdentity.FullName;
m_activationData = activationData;
}
public ActivationArguments (ActivationContext activationData) : this (activationData, null) {}
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
public ActivationArguments (ActivationContext activationContext, string[] activationData) {
if (activationContext == null)
throw new ArgumentNullException("activationContext");
Contract.EndContractBlock();
m_appFullName = activationContext.Identity.FullName;
m_appManifestPaths = activationContext.ManifestPaths;
m_activationData = activationData;
m_useFusionActivationContext = true;
}
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
internal ActivationArguments (string appFullName, string[] appManifestPaths, string[] activationData) {
if (appFullName == null)
throw new ArgumentNullException("appFullName");
Contract.EndContractBlock();
m_appFullName = appFullName;
m_appManifestPaths = appManifestPaths;
m_activationData = activationData;
m_useFusionActivationContext = true;
}
public ApplicationIdentity ApplicationIdentity {
get {
return new ApplicationIdentity(m_appFullName);
}
}
public ActivationContext ActivationContext {
[ResourceExposure(ResourceScope.None)]
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
get {
if (!UseFusionActivationContext)
return null;
if (m_appManifestPaths == null)
return new ActivationContext(new ApplicationIdentity(m_appFullName));
else
return new ActivationContext(new ApplicationIdentity(m_appFullName), m_appManifestPaths);
}
}
#endif // !FEATURE_PAL
private string[] m_activationData;
public string[] ActivationData {
get {
return m_activationData;
}
}
public override EvidenceBase Clone() {
ActivationArguments clone = new ActivationArguments();
clone.m_useFusionActivationContext = m_useFusionActivationContext;
clone.m_activateInstance = m_activateInstance;
clone.m_appFullName = m_appFullName;
if (m_appManifestPaths != null) {
clone.m_appManifestPaths = new string[m_appManifestPaths.Length];
Array.Copy(m_appManifestPaths, clone.m_appManifestPaths, clone.m_appManifestPaths.Length);
}
if (m_activationData != null) {
clone.m_activationData = new string[m_activationData.Length];
Array.Copy(m_activationData, clone.m_activationData, clone.m_activationData.Length);
}
#if !FEATURE_PAL
clone.m_activateInstance = m_activateInstance;
clone.m_appFullName = m_appFullName;
clone.m_useFusionActivationContext = m_useFusionActivationContext;
#endif // !FEATURE_PAL
return clone;
}
}
}
|