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.

PR-URL: https://github.com/nodejs/node-gyp/pull/2018
Reviewed-By: João Reis <reis@janeasystems.com>
This commit is contained in:
Andrew Casey 2020-01-08 13:49:39 -08:00 committed by João Reis
parent a79d866ac3
commit 1f7e1e93b5

View file

@ -205,7 +205,14 @@ namespace VisualStudioConfiguration
return;
}
instances.Add(InstanceJson(rgelt[0]));
try
{
instances.Add(InstanceJson(rgelt[0]));
}
catch (COMException)
{
// Ignore instances that can't be queried.
}
}
}