MemoryMarshal.{Try}Read/{Try}Write/AsRef should allow ref struct

Open
#113,132 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
csharp

Research direction

Start by locating the declarations for MemoryMarshal.Read, TryRead, Write, TryWrite, and both AsRef overloads, then compare their generic constraints. Done means all six listed APIs include the requested where T : allows ref struct constraint and the relevant runtime tests pass.

Written by the indexing model from the issue text.

Description

area-Interop-coreclr

We are missing where T : allows ref struct on:

  • MemoryMarshal.Read
  • MemoryMarshal.TryRead
  • MemoryMarshal.Write
  • MemoryMarshal.TryWrite
  • MemoryMarshal.AsRef
  • MemoryMarshal.AsRef (readonly ref)
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.