-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Bug
Copy link
Labels
area-System.Runtime.CompilerServicesin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedregression-from-last-release
Milestone
Description
Description
Spotted while porting my ComputeSharp samples to .NET 9 (see here). It seems that [UnsafeAccessor]
is broken in .NET 9 when used to access unspeakable fields (captured primary constructor parameters being a common example).
Reproduction Steps
using System.Runtime.CompilerServices;
Blah blah = new("Bob");
string name = Blah.GetName(in blah);
Console.WriteLine(name);
public readonly struct Blah(string name)
{
public string EnsureCaptured => name;
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "<name>P")]
public static extern ref readonly string GetName(ref readonly Blah value);
}
Expected behavior
Should work as expected.
Actual behavior
Regression?
Yes. Works fine on .NET 8.
Known Workarounds
None that I can think of.
Configuration
- .NET SDK 9.0.100
Metadata
Metadata
Assignees
Labels
area-System.Runtime.CompilerServicesin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedregression-from-last-release