lib: ignore VS instances that cause COMExceptions #2018
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
npm install && npm test
passesSome tests are failing, but they also fail without my change. I assume the CI system will catch actual failures.
I see that find-visualstudio has pretty good test coverage, but I didn't see an obvious way to simulate this COM failure
Are there user-facing docs for find-visualstudio? I'd be happy to add a blurb about ignoring certain instances.
Description of change
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.
Note: an alternative approach would be to print a JSON blob with an empty packages list and let the caller reject it with an explicit error message.