Previously for `<`/`<=` it would throw if `v1` argument was null, but for `>`/`>=` would throw if the `v1` argument was null, albeit using `v1` in the exception parameter name. It's also not expected for comparisons like this to throw, in general.
public static bool operator <(Version v1, Version v2)
{
- if ((object)v1 == null)
- throw new ArgumentNullException(nameof(v1));
+ if (v1 is null)
+ {
+ return !(v2 is null);
+ }
+
return (v1.CompareTo(v2) < 0);
}
public static bool operator <=(Version v1, Version v2)
{
- if ((object)v1 == null)
- throw new ArgumentNullException(nameof(v1));
+ if (v1 is null)
+ {
+ return true;
+ }
+
return (v1.CompareTo(v2) <= 0);
}
},
{
"name": "System.Tests.BufferTests.BlockCopy_Invalid",
- "reason" : "https://github.com/dotnet/coreclr/pull/23636"
+ "reason": "https://github.com/dotnet/coreclr/pull/23636"
+ },
+ {
+ "name": "System.Tests.VersionTests.Comparisons_NullArgument_ThrowsArgumentNullException",
+ "reason": "Version was improved to no longer throw from comparison operators"
},
]
}