Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.0 Preview: IComparer.Compare() Exception #112

Closed
kkbruce opened this issue Jan 15, 2020 · 3 comments · Fixed by #114
Closed

0.1.0 Preview: IComparer.Compare() Exception #112

kkbruce opened this issue Jan 15, 2020 · 3 comments · Fixed by #114

Comments

@kkbruce
Copy link

kkbruce commented Jan 15, 2020

I download 0.1.0 preview and run remove option, always throw exception.

C:\> dotnet-core-uninstall remove --all --sdk

Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Collections.Generic.ComparisonComparer`1[System.Int32]'.
   at System.Collections.Generic.IntrospectiveSortUtilities.ThrowOrIgnoreBadComparer(Object comparer)
   at System.Collections.Generic.GenericArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
   at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer)
   at System.Linq.EnumerableSorter`2.QuickSort(Int32[] keys, Int32 lo, Int32 hi)
   at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Microsoft.DotNet.Tools.Uninstall.Shared.VSVersioning.VisualStudioSafeVersionsExtractor.GetReasonRequiredStrings(IEnumerable`1 allBundles)
   at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.CommandBundleFilter.GetFilteredWithRequirementStrings()
   at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.UninstallCommandExec.Execute()
   at Microsoft.DotNet.Tools.Uninstall.Shared.Configs.CommandLineConfigs.<>c.<.cctor>b__39_6()
   at Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions.ExceptionHandler.<>c__DisplayClass0_0.<HandleException>b__0()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
@sfoslund
Copy link
Member

sfoslund commented Jan 15, 2020

@kkbruce Thanks for submitting this issue! I believe #111 will take care of this but I'd like to add some test coverage to check. I haven't been able to reproduce the issue- what happens when you run dotnet-core-uninstall list -v d?

@kkbruce
Copy link
Author

kkbruce commented Jan 20, 2020

I use "Add/Remove Programs" to remove all .NET Core SDK. No other information.

dotnet-core-uninstall list -v d

This tool can not uninstall versions of the runtime or SDK that are installed using Visual Studio 2019 Update 3 or via zip/scripts. The versions that can be uninstalled with this tool are:

.NET Core SDKs:

.NET Core Runtimes:

ASP.NET Core Runtimes:

.NET Core Runtime & Hosting Bundles:

@kkbruce kkbruce closed this as completed Jan 20, 2020
@bruce-willis
Copy link

@sfoslund Hey, unfortunately, I have exactly the same problem.

Error log
  dotnet-core-uninstall remove --all --sdk
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: 'System.Collections.Generic.ComparisonComparer`1[System.Int32]'.
 at System.Collections.Generic.IntrospectiveSortUtilities.ThrowOrIgnoreBadComparer(Object comparer)
 at System.Collections.Generic.GenericArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer)
 at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer)
 at System.Linq.EnumerableSorter`2.QuickSort(Int32[] keys, Int32 lo, Int32 hi)
 at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
 at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
 at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
 at Microsoft.DotNet.Tools.Uninstall.Shared.VSVersioning.VisualStudioSafeVersionsExtractor.GetReasonRequiredStrings(IEnumerable`1 allBundles)
 at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.CommandBundleFilter.GetFilteredWithRequirementStrings()
 at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.UninstallCommandExec.Execute()
 at Microsoft.DotNet.Tools.Uninstall.Shared.Configs.CommandLineConfigs.<>c.<.cctor>b__39_6()
 at Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions.ExceptionHandler.<>c__DisplayClass0_0.<HandleException>b__0()
 --- End of inner exception stack trace ---
 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
 at System.Delegate.DynamicInvokeImpl(Object[] args)
 at System.Delegate.DynamicInvoke(Object[] args)
 at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
 at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
 at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
Output of dotnet-core-uninstall list -v d
  dotnet-core-uninstall list -v d

This tool can not uninstall versions of the runtime or SDK that are installed using Visual Studio 2019 Update 3 or via zip/scripts. The versions that can be uninstalled with this tool are:

.NET Core SDKs:
3.0.100-preview5-011568  x64  "Microsoft .NET Core SDK 3.0.100 - preview5 (x64)"  [Maybe needed for Visual Studio.    Specify individually or use --force to remove]
2.2.203                  x64  "Microsoft .NET Core SDK 2.2.203 (x64)"             [Maybe needed for Visual Studio     2019. Specify individually or use   --force to remove]
2.1.800-preview-009696   x64  "Microsoft .NET Core SDK 2.1.800 - preview (x64)"   [Maybe needed for Visual Studio     2019. Specify individually or use   --force to remove]
2.1.800-preview-009677   x64  "Microsoft .NET Core SDK 2.1.800 - preview (x64)"                                       
2.1.700-preview-009618   x64  "Microsoft .NET Core SDK 2.1.700 - preview (x64)"                                       
2.1.700-preview-009601   x64  "Microsoft .NET Core SDK 2.1.700 - preview (x64)"                                       
2.1.700-preview-009597   x64  "Microsoft .NET Core SDK 2.1.700 - preview (x64)"                                       
2.1.505                  x64  "Microsoft .NET Core SDK 2.1.505 (x64)"             [Maybe needed for Visual Studio     2017. Specify individually or use   --force to remove]
2.1.503                  x64  "Microsoft .NET Core SDK 2.1.503 (x64)"                                                 
2.1.500                  x64  "Microsoft .NET Core SDK 2.1.500 (x64)"                                                 
2.1.500-preview-009404   x64  "Microsoft .NET Core SDK 2.1.500 - preview (x64)"                                       
2.1.500-preview-009335   x64  "Microsoft .NET Core SDK 2.1.500 - preview (x64)"                                       
2.1.500-preview-009297   x64  "Microsoft .NET Core SDK 2.1.500 - preview (x64)"                                       
2.1.403                  x64  "Microsoft .NET Core SDK 2.1.403 (x64)"                                                 
2.1.401                  x64  "Microsoft .NET Core SDK 2.1.401 (x64)"                                                 
2.1.400                  x64  "Microsoft .NET Core SDK 2.1.400 (x64)"                                                 
2.1.400-preview-009171   x64  "Microsoft .NET Core SDK 2.1.400 - preview (x64)"                                       
2.1.400-preview-009063   x64  "Microsoft .NET Core SDK 2.1.400 - preview (x64)"                                       
2.1.200-preview-007597   x64  "Microsoft .NET Core SDK - 2.1.200 (x64)"           [Maybe needed for Visual Studio.    Specify individually or use --force to remove]
2.1.200-preview-007589   x64  "Microsoft .NET Core SDK - 2.1.200 (x64)"                                               
2.1.200-preview-007576   x64  "Microsoft .NET Core SDK - 2.1.200 (x64)"                                               
2.1.200-preview-007517   x64  "Microsoft .NET Core SDK - 2.1.200 (x64)"                                               
2.1.200-preview-007474   x64  "Microsoft .NET Core SDK - 2.1.200 (x64)"                                               
2.1.104                  x64  "Microsoft .NET Core SDK - 2.1.104 (x64)"                                               
2.1.103                  x64  "Microsoft .NET Core SDK - 2.1.103 (x64)"                                               
2.1.102                  x64  "Microsoft .NET Core SDK - 2.1.102 (x64)"                                               
2.1.100                  x64  "Microsoft .NET Core SDK - 2.1.100 (x64)"                                               
2.1.100-preview-007363   x64  "Microsoft .NET Core SDK - 2.1.100 (x64)"                                               
2.1.100-preview-007354   x64  "Microsoft .NET Core SDK - 2.1.100 (x64)"                                               
2.1.100-preview-007326   x64  "Microsoft .NET Core SDK - 2.1.100 (x64)"                                               
2.1.4                    x64  "Microsoft .NET Core SDK - 2.1.4 (x64)"                                                 
2.1.2                    x64  "Microsoft .NET Core SDK - 2.1.2 (x64)"                                                 
2.1.1                    x64  "Microsoft .NET Core SDK - 2.1.1 (x64)"                                                 
2.1.1-preview-007165     x64  "Microsoft .NET Core SDK - 2.1.1 (x64)"                                                 
2.0.3                    x64  "Microsoft .NET Core SDK - 2.0.3 (x64)"                                                 
2.0.2                    x64  "Microsoft .NET Core SDK - 2.0.2 (x64)"                                                 
2.0.0                    x64  "Microsoft .NET Core SDK - 2.0.0 (x64)"                                                 

.NET Core Runtimes:
2.0.0  x64  "Microsoft .NET Core Runtime - 2.0.0 (x64)"

ASP.NET Core Runtimes:

.NET Core Runtime & Hosting Bundles:

Let me know if you will need some additional info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants