dotnet / dotnet/dotnet-api-docs

`WindowsIdentity` references .NET Framework code and has bad example code

Open
#10,927 1 comment 0 reactions 0 assignees View on GitHub
area-System.Security untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Type of issue

Code doesn't work

### Description

The [.NET CoreWindowsIdentity documentation](https://learn.microsoft.com/en-us/dotnet/api/system.security.principal.windowsidentity?view=net-8.0) has various places that link to the [.NET Framework WindowsImpersonationContext class](https://learn.microsoft.com/en-us/dotnet/api/system.security.principal.windowsimpersonationcontext?view=netframework-4.8.1&viewFallbackFrom=net-8.0) that does not exist in .NET Core, and the example code is copied verbatim from the [.NET Framework version of WindowsIdentity's doc](https://learn.microsoft.com/en-us/dotnet/api/system.security.principal.windowsidentity?view=netframework-4.8.1), which would not work or even compile, since it references an `Impersonate()` method, which as far as I can tell is only in the .NET Framework version of `WindowsIdentity`, not in the [.NET Core version of it](https://github.com/dotnet/runtime/blob/7c8d89cc8efa5dbe38b49caaeb39abbb0eee9746/src/libraries/System.Security.Principal.Windows/src/System/Security/Principal/WindowsIdentity.cs#L365).

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.security.principal.windowsidentity?view=net-8.0

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Security.Principal/WindowsIdentity.xml

### Document Version Independent Id

b7498a9d-cecb-02e5-9865-e690bbaa9225

### Article author

@dotnet-bot

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.