-
Couldn't load subscription status.
- Fork 833
Closed
Closed
Copy link
Labels
Milestone
Description
Equality comparison of a record type with private fields no longer works in SDK 8.0.400 for a type that is in a different assembly.
Repro steps
Assembly A:
Record type with private fields.
module Types
type Value =
private { value: uint32 }
static member Zero = { value = 0u }
static member Create(value: int) = { value = uint value }Assembly B:
Anything that uses the = operator on the type.
module Test
open NUnit.Framework
open Types
[<Test>]
let Equality () =
let zero = Value.Create 0
Assert.That(Value.Zero = zero, "zero equals zero")Expected behavior
Equality comparison works.
Actual behavior
Runtime exception:
System.MethodAccessException : Attempt by method 'Test.Equality()' to access method 'Types+Value.Equals(Value, System.Collections.IEqualityComparer)' failed.
Known workarounds
- Remove the
privatemodifier. - Replace
=withEqualscall.
Related information
- .NET SDK 8.0.400-preview.0.24324.5
katatunix and Thecentury
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done