summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ghiondea <AlexGhiondea@users.noreply.github.com>2017-05-10 16:45:01 -0700
committerJan Kotas <jkotas@microsoft.com>2017-05-10 16:45:01 -0700
commit0dcdd0d9edd30fddd7dcb1c0e149abffb4e0a1cd (patch)
tree6a1047e957d50762729a52baa53b4f18aa9bb7d5
parent377073385e4545d36e1a96429dd78548f87c597c (diff)
downloadcoreclr-0dcdd0d9edd30fddd7dcb1c0e149abffb4e0a1cd.tar.gz
coreclr-0dcdd0d9edd30fddd7dcb1c0e149abffb4e0a1cd.tar.bz2
coreclr-0dcdd0d9edd30fddd7dcb1c0e149abffb4e0a1cd.zip
Allow multiple SetData calls on AppDomain (#11496)
* Allow multiple SetData calls on AppDomain * Remove restriction from GetData and remove now-dead code Locate * Remove LoaderOptimization check since it is not used on CoreCLR
-rw-r--r--src/mscorlib/src/System/AppDomain.cs47
-rw-r--r--src/mscorlib/src/System/AppDomainSetup.cs12
2 files changed, 6 insertions, 53 deletions
diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs
index edd53b22da..76e7f8f845 100644
--- a/src/mscorlib/src/System/AppDomain.cs
+++ b/src/mscorlib/src/System/AppDomain.cs
@@ -566,17 +566,6 @@ namespace System
throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
- // SetData should only be used to set values that don't already exist.
- object currentVal;
- lock (((ICollection)LocalStore).SyncRoot)
- {
- LocalStore.TryGetValue(name, out currentVal);
- }
- if (currentVal != null)
- {
- throw new InvalidOperationException(SR.InvalidOperation_SetData_OnlyOnce);
- }
-
lock (((ICollection)LocalStore).SyncRoot)
{
LocalStore[name] = data;
@@ -590,38 +579,14 @@ namespace System
throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
- int key = AppDomainSetup.Locate(name);
- if (key == -1)
- {
- if (name.Equals(AppDomainSetup.LoaderOptimizationKey))
- return FusionStore.LoaderOptimization;
- else
- {
- object data;
- lock (((ICollection)LocalStore).SyncRoot)
- {
- LocalStore.TryGetValue(name, out data);
- }
- if (data == null)
- return null;
- return data;
- }
- }
- else
+ object data;
+ lock (((ICollection)LocalStore).SyncRoot)
{
- // Be sure to call these properties, not Value, so
- // that the appropriate permission demand will be done
- switch (key)
- {
- case (int)AppDomainSetup.LoaderInformation.ApplicationBaseValue:
- return FusionStore.ApplicationBase;
- case (int)AppDomainSetup.LoaderInformation.ApplicationNameValue:
- return FusionStore.ApplicationName;
- default:
- Debug.Assert(false, "Need to handle new LoaderInformation value in AppDomain.GetData()");
- return null;
- }
+ LocalStore.TryGetValue(name, out data);
}
+ if (data == null)
+ return null;
+ return data;
}
[Obsolete("AppDomain.GetCurrentThreadId has been deprecated because it does not provide a stable Id when managed threads are running on fibers (aka lightweight threads). To get a stable identifier for a managed thread, use the ManagedThreadId property on Thread. http://go.microsoft.com/fwlink/?linkid=14202", false)]
diff --git a/src/mscorlib/src/System/AppDomainSetup.cs b/src/mscorlib/src/System/AppDomainSetup.cs
index 142b8a05f7..589ed1812a 100644
--- a/src/mscorlib/src/System/AppDomainSetup.cs
+++ b/src/mscorlib/src/System/AppDomainSetup.cs
@@ -338,18 +338,6 @@ namespace System
}
}
- static internal int Locate(String s)
- {
- if (String.IsNullOrEmpty(s))
- return -1;
-
- Debug.Assert('A' == ACTAG_APP_BASE_URL[0], "Assumption violated");
- if (s[0] == 'A' && s == ACTAG_APP_BASE_URL)
- return (int)LoaderInformation.ApplicationBaseValue;
-
- return -1;
- }
-
#if FEATURE_COMINTEROP
public bool SandboxInterop
{