summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEirik Tsarpalis <eirik.tsarpalis@gmail.com>2020-02-18 21:31:53 (GMT)
committerGitHub <noreply@github.com>2020-02-18 21:31:53 (GMT)
commita95569a88d35ea4d3ec9e0ecbe6f1acb5e72a063 (patch)
tree45305af87d27b64ff967e256f507f2536642f786 /src
parent25bb13bc33c5911c6319722203dbb83eaebe7b08 (diff)
downloadcoreclr-a95569a88d35ea4d3ec9e0ecbe6f1acb5e72a063.zip
coreclr-a95569a88d35ea4d3ec9e0ecbe6f1acb5e72a063.tar.gz
coreclr-a95569a88d35ea4d3ec9e0ecbe6f1acb5e72a063.tar.bz2
Fix AppDomain.SetPrincipalPolicy bug for new threads (#32104) (#28019)
* fix principal policy for new threads Fixes #31717 Co-authored-by: Marco Rossignoli <marco.rossignoli@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Thread.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Thread.cs b/src/System.Private.CoreLib/shared/System/Threading/Thread.cs
index 28b2e6e..a2be70c 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Thread.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Thread.cs
@@ -136,11 +136,12 @@ namespace System.Threading
{
get
{
- if (s_asyncLocalPrincipal is null)
+ IPrincipal? principal = s_asyncLocalPrincipal?.Value;
+ if (principal is null)
{
- CurrentPrincipal = AppDomain.CurrentDomain.GetThreadPrincipal();
+ CurrentPrincipal = (principal = AppDomain.CurrentDomain.GetThreadPrincipal());
}
- return s_asyncLocalPrincipal?.Value;
+ return principal;
}
set
{