From d6a5973ba0e00a5ea6ece824a25e61acc1e5fac9 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 8 Jan 2020 13:49:39 -0800 Subject: [PATCH 1/2] lib: ignore VS instances that cause COMExceptions I have quite a few instances of VS installed and it looks like Find-VisualStudio.cs enumerates all of them, even when find-visualstudio.js already knows which one it wants (from the environment variable in the developer command prompt). One of them (from 15.7.2, if that's interesting) causes a COMException on the ISetupInstance2.GetPackages call. Ignoring such packages seems harmless and unblocks the rest of the run. --- lib/Find-VisualStudio.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Find-VisualStudio.cs b/lib/Find-VisualStudio.cs index 0a533f42d6..c4e18e799b 100644 --- a/lib/Find-VisualStudio.cs +++ b/lib/Find-VisualStudio.cs @@ -205,7 +205,14 @@ public static void PrintJson() return; } - instances.Add(InstanceJson(rgelt[0])); + try + { + instances.Add(InstanceJson(rgelt[0])); + } + catch + { + // Ignore instances that can't be queried. + } } } From 1cc7f6cb76edbdba4c22c098877dca671c89b29f Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Wed, 8 Jan 2020 18:25:30 -0800 Subject: [PATCH 2/2] Suppress only COMExceptions --- lib/Find-VisualStudio.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Find-VisualStudio.cs b/lib/Find-VisualStudio.cs index c4e18e799b..d2e45a7627 100644 --- a/lib/Find-VisualStudio.cs +++ b/lib/Find-VisualStudio.cs @@ -209,7 +209,7 @@ public static void PrintJson() { instances.Add(InstanceJson(rgelt[0])); } - catch + catch (COMException) { // Ignore instances that can't be queried. }