Closed vjacquet closed 1 year ago
What issue is this causing for you?
None, but is it relevant? Well, I guess it is, because even though it is probably inconsequential, fixing it would be a breaking change.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
Hello,
As it is currently implemented, CompareTo always return 0, meaning equality, for objects of any type or even for null references. https://github.com/jbogard/MediatR/blob/a9e032dbf3d19aff0212fb12e4ba2c79450e61f4/src/MediatR.Contracts/Unit.cs#L47
This is inconsistent with Equals that correctly returns true only when the parameter is of the same type. https://github.com/jbogard/MediatR/blob/a9e032dbf3d19aff0212fb12e4ba2c79450e61f4/src/MediatR.Contracts/Unit.cs#L73
IComparable contract states that CompareTo throws ArgumentException when obj is not the same type as this instance.
A possible implementation could be