Skip to content

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

Open
@tfenise

Description

@tfenise

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."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions