dotnet / dotnet/dotnet-api-docs

Documentation "remarks" section is inconsistent with actual implementation

Open
#8,388 0 comments 1 reaction 0 assignees View on GitHub
area-System.Threading Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The **Remarks** section of the [Interlocked.MemoryBarrier](https://docs.microsoft.com/en-us/dotnet/api/system.threading.interlocked.memorybarrier) method document is inconsistent with the actual implementation.

to quote:

> This method was added to the [Interlocked](https://docs.microsoft.com/en-us/dotnet/api/system.threading.interlocked?view=net-6.0) class in the .NET Framework 4.5 as a convenience;
> _it's a wrapper for the [Thread.MemoryBarrier](https://docs.microsoft.com/en-us/dotnet/api/system.threading.thread.memorybarrier?view=net-6.0) method._

This statement is correct for .NET Framework 4.x version. see [Source Code](https://referencesource.microsoft.com/#mscorlib/system/threading/interlocked.cs,251) in [Microsoft Reference Code](https://referencesource.microsoft.com/).

But when it comes to .NET [Core] the implementation is reversed. see [Source Code](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs#L549) in GitHub.

This might lead to some misunderstandings when reading the docs.

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.