Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[release/3.1] Port dotnet/runtime#32104 fix for Thread.CurrentPrincipal regression #28019

Merged

Conversation

eiriktsarpalis
Copy link
Member

@eiriktsarpalis eiriktsarpalis commented Feb 17, 2020

Backports a fix for issue dotnet/runtime#31717 which concerns a regression in the behaviour of the Thread.CurrentPrincipal property, introduced in 3.0.

This has already been fixed in .NET 5 (see dotnet/runtime#32104). This PR ports that fix down to release/3.1.

Customer Impact

Assigning a PrincipalPolicy to the current AppDomain results in the first thread correctly returning Thread.CurrentPrincipal. However it will consistently return null for any subsequent threads. There are no known workarounds to this issue.

Regression?

Functional regression between 2.1 and 3.0 here - original issue here). Reported by 2 customers.

Testing

The .NET 5 fix at dotnet/runtime#32104 includes tests for the fix.

Risk

Moderate. The regression was introduced in an attempt to introduce new behaviour (i.e. flowing the principal with ExecutionContext), but this was broken in all but the most trivial scenaria (using just one thread). It is conceivable that fixing this might expose other problems, or in the very least break applications written against 3.0 that implicitly depend on the current behaviour of the property.

Code Reviewer

@jkotas

* fix principal policy for new threads

Fixes #31717
@jkotas
Copy link
Member

jkotas commented Feb 17, 2020

Right, the tests are in corefx. The workflow is to make the implementation change in coreclr first. Once the change propagates to corefx, enable the tests there.

@eiriktsarpalis eiriktsarpalis changed the title Fix AppDomain.SetPrincipalPolicy bug for new threads (#32104) [release/3.1] Port dotnet/runtime#32104 fix for Thread.CurrentPrincipal regression Feb 17, 2020
@danmoseley danmoseley added the Servicing-consider Issue for next servicing release review label Feb 17, 2020
@danmoseley
Copy link
Member

Matching tests: dotnet/corefx#42860

@danmoseley danmoseley closed this Feb 18, 2020
@danmoseley danmoseley reopened this Feb 18, 2020
@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Feb 18, 2020
@leecow leecow added this to the 3.1.3 milestone Feb 18, 2020
@danmoseley
Copy link
Member

Approved, please get CR and CI green and @Anipik will merge (I believe deadline is end of day)

@eiriktsarpalis
Copy link
Member Author

All green, should be ready to merge @Anipik

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants