diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs index afc597ecf0..6aa45b3005 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/JsonRpcExtensionService.cs @@ -327,10 +327,9 @@ public sealed partial class JsonRpcExtensionService : IExtensionService, IJsExte return []; } - // Start the watcher before scanning so a package installed while the scan runs - // is still observed (the per-directory gate and the already-loaded check make a - // watcher-driven load and a scan-driven load for the same directory idempotent). RecoverStaleGalleryInstallMarkersOnce(); + + // Start the watcher before scanning so installs during the scan are still observed. StartDirectoryWatcher(); var accepted = DiscoverAcceptedManifests(ExtensionsPath); diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/NpmCommandRunner.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/NpmCommandRunner.cs index 15c14119fa..50f5199cc6 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/NpmCommandRunner.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Services/NpmCommandRunner.cs @@ -549,9 +549,14 @@ public sealed class NpmCommandRunner : INpmCommandRunner return true; } - return exception is AggregateException aggregateException - && aggregateException.Flatten().InnerExceptions.Count > 0 - && aggregateException.Flatten().InnerExceptions.All(IsExpectedTerminationException); + if (exception is not AggregateException aggregateException) + { + return false; + } + + var flattenedException = aggregateException.Flatten(); + return flattenedException.InnerExceptions.Count > 0 + && flattenedException.InnerExceptions.All(IsExpectedTerminationException); } private static bool IsReparsePoint(string path)