[vs17.13] Don't mark synthesized projects dirty when SDKs define properties #11478
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.
Context
Fixes #11394
This is a regression. The bug appeared after Expand MSBuildSdkResolver.
Customer impact
Without this fix the customers that opt-into
MsBuildUseSimpleProjectRootElementCacheConcurrency
will getSystem.NotImplementedException
. This includesslngen
andquickbuild
.Details
The
NotImplementedException
is thrown here:msbuild/src/Build/Evaluation/SimpleProjectRootElementCache.cs
Lines 133 to 136 in aff5455
Previously the
SdkResult
ofMSBuildSdkResolver
was empty andProjectRootElement
was never created for it. Now, it contains 2 properties, and whenProjectRootElement
is created, every change marks it as dirty. The fix is not to mark it dirty when it is fromSdkResult
Changes made
Implemented internal
CreateNotDirty
that createsProjectRootElement
that cannot be dirtied.Testing
Added unit test for
CreateNotDirty
. Also manually tested that the exception is not thrown anymore.Risks
Low - existing tests ensure that other scenarios are not broken, added new test, also tested manually this exact case.