Code to find MSBuild 15 toolset is not resilient to installations with errors
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
On one machine my VS 2017 installation had errors (which is apparently not uncommon). On that machine hosting MSBuild 15 resulted in a lot of hard-to-diagnose problems. After some investigation I've narrowed it down to the codepath enumerating VS 2017 installations not returning any instances.
It turns out the code here is not tolerant against this case:
http://source.dot.net/#Microsoft.Build/SharedUtilities/VisualStudioLocationHelper.cs,59
It checks for InstanceState.Complete, which is sometimes too restrictive. Here's the InstanceState enum:
```
namespace Microsoft.VisualStudio.Setup.Configuration
{
[Flags]
public enum InstanceState : uint
{
None = 0,
Local = 1,
Registered = 2,
NoRebootRequired = 4,
NoErrors = 8,
Complete = uint.MaxValue
}
}
```
The code in MSBuild only adds an instance if the state is Complete. However on the machine in question the state was Local | Registered | NoRebootRequired. Due to errors during setup the NoErrors flags was not set.
My understanding is that this check should include the instance if the state is anything but None or maybe ignore the State flag entirely.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.