dotnet / dotnet/dotnet-api-docs

XML documentation comments and exception message of MemoryMarshal.Cast are inaccurate

Open
#11,319 2 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime.InteropServices untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://github.com/dotnet/runtime/blob/3bacc83b4f3d21df591cc25b667b5198d8cebcff/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/MemoryMarshal.cs#L102-L121
(also the `ReadOnlySpan<>` overload)

1. It doesn't just work on primitive types.
2. (Unmanaged) pointers are OK.
3. The error message with `ThrowHelper.ThrowInvalidTypeWithPointersNotSupported` is also inaccurate: "...Only value types without pointers or references are supported."

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.