-
-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Can't use latest version of BenchmarkDotNet #2346
Comments
Should this be in dotnet/BenchmarkDotNet instead? |
The following reproduces the problem: var t1 = (new CultureInfo("en-US"), CompareOptions.Ordinal, false);
var t2 = (new CultureInfo("pl-PL"), CompareOptions.None, false);
Assert.IsTrue(typeof(IComparable).IsAssignableFrom(t1.GetType())); // Succeeds
var result = t1.CompareTo(t2); // Throws System.ArgumentException: At least one object must implement IComparable. This is because In this particular case, One potential solution is to have specific support for detecting For reference, the |
Working on this fix. Let me know which of the following two solutions I listed above do you prefer:
Any other suggested solution? |
@mrahhal Maybe just catch the exception and fall back to string comparison? |
Could do that, but that might hide other unrelated exceptions we didn't intend to hide. Might be better to properly handle this particular case in my opinion. |
@mrahhal How is the fix looking? Any ETA? Thanks. |
Was waiting for a reply as I didn't want to work on something and then change it right after a review. And honestly forgot about it while waiting. Ready to roll out a fix when a maintainer confirms one of my two suggestions above.. Or I think I'll just go with whatever I think is better to start with. Will submit a PR soon. |
I think if you want to handle
Just be aware that they can have variable number of types and nested |
Going through |
That's an internal interface (and it only has a Size prop, I don't think it helps much anyway).
Yes. A simple recursive check will do for nesting. The problem is actually how to detect Starting to think handling exceptions when calling the |
It's public interface. And has also indexer. |
I think it's internal in netstandard. But more importantly, isn't |
Yeah, you need at least Both |
BDN has a transitive reference to the public interface ITuple
{
int Length { get; }
object this[int index] { get; }
} |
Oh weird, it's not public from the nuget package. You may still be able to use it with reflection, though. |
Would going this far really be worth it here? 😅 I think it's better to just solve it the reliable way for now. Catch the exception and fallback. |
I also find that acceptable. Just catch the exact exception type and compare the message to avoid suppressing erroneous exceptions.
|
I tried to use the latest bdn master (73f8fd1) here, but trying to run benchmarks fails with:
This seems to be failing for
.. , because
CultureInfo
does not implementIComparable
.IIUC, this is a new code path introduced as part of #2304 .
And it fails for https://github.com/dotnet/performance/blob/dd14c7d44444a0211035af8464b743a55b4dd55e/src/benchmarks/micro/libraries/System.Globalization/StringSearch.cs#L46 .
cc @mrahhal @adamsitnik @LoopedBard3
The text was updated successfully, but these errors were encountered: