Skip to content

Summary for CompareExchange<T> should not mention reference types as of .NET 9 #11419

Open
@paulbartrum

Description

@paulbartrum

Type of issue

Outdated article

Description

The summary for the generic version of CompareExchange<T> states: "Compares two instances of the specified reference type T for reference equality..." but that is no longer true as of .NET 9. Specifically, the class constraint was removed in .NET 9 so that a reference to a primitive value type (like bool/enum) can be passed into the method. See dotnet/runtime#104558 for the pull request where the change was made.

Exchange<T> was also changed as part of the same pull request, but the documentation only says "a variable of the specified type" and doesn't mention reference types so it's presumably correct.

EDIT: Exchange<T> is wrong as well because it says "This method only supports reference types." and "...there is no support for other value types.".

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.threading.interlocked.compareexchange?view=net-10.0#system-threading-interlocked-compareexchange-1(-0@-0-0)

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Threading/Interlocked.xml

Document Version Independent Id

9651cd4a-a520-66e4-8303-4eb5e62f6d81

Platform Id

3ad985f3-bce2-d418-b37e-27815da4a1d4

Article author

@dotnet-bot

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions