Fix build race condition in VS templates#6413
Conversation
…r a number of manual tests, works with single-project C# and C#/C++ wapproj (not C# unit test)
…nd start after package installation
…arted and the Unadvise call was premature
…ngs (resolves in one click instead of two)
guimafelipe
left a comment
There was a problem hiding this comment.
Overall, it was a bit harder to track what the build guard is doing. There were a group of booleans that were always changed and used to check what to do. I would advise to change the design a bit to be a proper state machine, with clear transitions between the state instead of tracking those 6 boolean values. What do you think?
| public void SetReleaseCondition(Func<bool> condition) | ||
| { | ||
| _shouldRelease = condition; | ||
| } | ||
|
|
||
| public void SetInfoBarMessage(string message) | ||
| { | ||
| ThreadHelper.ThrowIfNotOnUIThread(); | ||
| _infoBarMessage = message; | ||
| if (_isBlocking) | ||
| { | ||
| ShowInfoBarWhenShellReady(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Could we use the C# setter/getter here for clarity?
There was a problem hiding this comment.
While it's theoretically possible, I'm not sure it makes sense for SetInfoBarMessage because it calls a UI change ShowInfoBarWhenShellIsReady() as well as assigning the _message value.
| return; | ||
| } | ||
|
|
||
| _solutionBuildManager5 = ServiceProvider.GlobalProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager5; |
There was a problem hiding this comment.
Do we need to get it every time? Can we just set this up in the constructor once?
Before
If a user attempts to build the C# templates before the NuGet wizard installs package dependencies, the build would fail with Xaml compile errors
With this PR
Validation
Manual Validation
A microsoft employee must use /azp run to validate using the pipelines below.
WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.
For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.