dotnet / dotnet/dotnet-api-docs
`ClaimsPrincipal.Current` documentation incorrect for .net core (all versions)
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
The documentation for `ClaimsPrincipal.Current` says:
> By default, Thread.CurrentPrincipal is returned. You can change this behavior by setting the ClaimsPrincipalSelector property to specify a delegate to be called to determine the current principal.
That is true for the .NET Framework, but is not true for .NET Core or current .NET 5 previews.
The actual behavior for .net core is as follows:
> By default, null is returned. You can change this behavior by setting the ClaimsPrincipalSelector property to specify a delegate to be called to determine the current principal.
This is because `ClaimsPrincipalSelector` defaults to null (in all frameworks, as correctly documented), but in .NET Framework it has an internal fallback method `ClaimsPrincipal.SelectClaimsPrincipal()`, which uses Thread.CurrentPrincipal. That fallback does not exist in .NET Core.
Contributor guide
Assessment
This issue has not been assessed yet.