Skip to content

Record structs with InlineArray attribute compares only by the first value. #73504

Closed
@Ilchert

Description

@Ilchert

Related to the dotnet/runtime/issues/96943.

Version Used:
dotnet SDK 8.0.204

Steps to Reproduce:

  1. Create record struct with InlineArray attribute
  2. Call equals.
  3. Record structs with InlineArray attribute compares only by the first value.
var a1 = new A();
a1[0]=1;
a1[1]=2;

var a2 = new A();
a2[0] = 1;
a2[1] = 1;


Console.WriteLine(a1.Equals(a2));

[InlineArray(2)]
record struct A
{
   public int P;
}

sharplab

Expected Behavior:
Should compare all values in inline array and print false in this case.

Actual Behavior:
Compares only the first element.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions