PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

CommandNotFound crashes pwsh if DNS server is not found

Open MizardX opened this issue 9 months ago • 2 comments

Microsoft PowerToys version

0.81.0

Installation method

PowerToys auto-update

Running as admin

None

Area(s) with issue?

Command not found

Steps to reproduce

  1. Configure an invalid DNS server, or somehow break communication with the DNS server.
  2. Open pwsh.exe
  3. Press ENTER

✔️ Expected Behavior

Nothing will happen.

❌ Actual Behavior

pwsh.exe crashes, leaving the following stacktrace in Windows Event Log:

Application: pwsh.exe
CoreCLR Version: 8.0.424.16909
.NET Version: 8.0.4
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Management.Automation.CmdletInvocationException: An error occurred while connecting to the catalog.
 ---> Microsoft.WinGet.Client.Engine.Exceptions.CatalogConnectException: An error occurred while connecting to the catalog.
   at Microsoft.WinGet.Client.Engine.Commands.Common.FinderCommand.GetPackageCatalog(CompositeSearchBehavior behavior)
   at Microsoft.WinGet.Client.Engine.Commands.Common.FinderCommand.FindPackages(CompositeSearchBehavior behavior, UInt32 limit, PackageFieldMatchOption match)
   at Microsoft.WinGet.Client.Engine.Commands.Common.FinderExtendedCommand.FindPackages(CompositeSearchBehavior behavior, PackageFieldMatchOption match)
   at Microsoft.WinGet.Client.Engine.Commands.FinderPackageCommand.<>c__DisplayClass1_0.<Find>b__0()
   at Microsoft.WinGet.Client.Engine.Commands.Common.ManagementDeploymentCommand.Execute[TResult](Func`1 func)
   at Microsoft.WinGet.Client.Engine.Commands.FinderPackageCommand.Find(String psPackageFieldMatchOption)
   at Microsoft.WinGet.Client.Commands.FindPackageCmdlet.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
   at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
   at Microsoft.WinGet.CommandNotFound.WinGetCommandNotFoundFeedbackPredictor.WarmUp()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

Other Software

Windows 11 23H2 PowerShell 7.4.2 Oh My Posh 20.2.0

MizardX avatar May 24 '24 16:05 MizardX