You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're currently setting a WindowsPrincipal principal policy during endpoint startup, even when we are running on non-Windows OSes.
This is relatively harmless when using .NET Core 2.x because the current principal, for example via Thread.CurrentPrincipal, will be null when running on non-Windows OSes.
However, when using .NET Core 3.x, this presents a bigger problem. Accessing the principal when it is a WindowsPrincipal on a non-Windows OS instead throws a PlatformNotSupportedException.
The way to fix this with the least impact would to call AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal) only when we are running on Windows since this will maintain the .NET Core 2.x behavior of getting a null value from things like Thread.CurrentPrincipal.
Who's affected
Anyone using .NET Core 3.x on macOS or Linux and accesses Thread.CurrentPrincipal in their code.
Symptoms
After starting the endpoint, getting the value of Thread.CurrentPrincipal will throw a PlatformNotSupportedException.
bording
changed the title
Setting a WindowsPrincipal on non-Windows OSes is problematic
Setting a WindowsPrincipal on non-Windows OSes can throw PlatformNotSupportedException
Feb 17, 2020
bording
changed the title
Setting a WindowsPrincipal on non-Windows OSes can throw PlatformNotSupportedException
Accessing Thread.CurrentPrincipal will throw PlatformNotSupportedException on .NET Core 3.x
Feb 17, 2020
bording
changed the title
Accessing Thread.CurrentPrincipal will throw PlatformNotSupportedException on .NET Core 3.x
Thread.CurrentPrincipal will throw PlatformNotSupportedException on .NET Core 3.x
Feb 17, 2020
bording
changed the title
Thread.CurrentPrincipal will throw PlatformNotSupportedException on .NET Core 3.x
Thread.CurrentPrincipal throws PlatformNotSupportedException on .NET Core 3.x
Feb 26, 2020
We're currently setting a
WindowsPrincipal
principal policy during endpoint startup, even when we are running on non-Windows OSes.This is relatively harmless when using .NET Core 2.x because the current principal, for example via
Thread.CurrentPrincipal
, will benull
when running on non-Windows OSes.However, when using .NET Core 3.x, this presents a bigger problem. Accessing the principal when it is a
WindowsPrincipal
on a non-Windows OS instead throws aPlatformNotSupportedException
.The way to fix this with the least impact would to call
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
only when we are running on Windows since this will maintain the .NET Core 2.x behavior of getting anull
value from things likeThread.CurrentPrincipal
.Who's affected
Anyone using .NET Core 3.x on macOS or Linux and accesses
Thread.CurrentPrincipal
in their code.Symptoms
After starting the endpoint, getting the value of
Thread.CurrentPrincipal
will throw aPlatformNotSupportedException
.Backported to
The text was updated successfully, but these errors were encountered: