dotnet / dotnet/cli-lab

dotnet-core-uninstall.exe remove --all-below 6.0.0 --force --sdk Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Open
#242 0 comments 0 reactions 0 assignees View on GitHub
Area-Uninstall-Tool
Dominant language
C#
Stars
774
Forks
72
Avg merge
1d 23h
Merged PRs (30d)
2

Description

C:\Program Files (x86)\dotnet-core-uninstall>echo y | dotnet-core-uninstall.exe remove --all-below 6.0.0 --force --sdk
The following items will be removed:
Microsoft .NET SDK 5.0.408 (x64)

To avoid breaking Visual Studio or other problems, read https://aka.ms/dotnet-core-uninstall-docs.

Do you want to continue? [y/n]
Microsoft .NET SDK 5.0.408 (x64): Used by Visual Studio. Specify individually or use --force to remove

Uninstalling this item will cause Visual Studio to break.

Are you sure you want to continue? [y/n] Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.UninstallCommandExec.AskWithWarningsForRequiredBundles(IDictionary`2 bundles, String userResponse)
at Microsoft.DotNet.Tools.Uninstall.Shared.Commands.UninstallCommandExec.Execute(IBundleCollector bundleCollector)
at Microsoft.DotNet.Tools.Uninstall.Shared.Configs.CommandLineConfigs.<>c__DisplayClass40_0.<.cctor>b__6()
at Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions.ExceptionHandler.<>c__DisplayClass0_0.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__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__21_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__22_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__20_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__11_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__10_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<b__0>d.MoveNext()

When I run manually then it works. Any idea why the automatic solution doesn't work?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.