[release/5.0] Fix incremental build issue in WPF's markup compiler #4098
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.
Description[release/5.0] Fix incremental build issue in WPF's markup compiler
This moves @MichaeIDietrich's original PR from master.
WPF rebuilds its intermediate assembly containing local types when no inputs have changed.
As part of the WPF's incremental build logic, WPF applies a hash to the list of reference filenames during compilation. The hash value is written to a cache file and compared against the hash value of the new list of reference filenames next compile. This comparison always fails due to the hash value for the same list of strings differing between runs and causes WPF to always build its intermediate project, even when inputs have not changed. .NET's GetHashCode is not stable between separate application runs as it was in .NET Framework.
Customer ImpactOne large internal Microsoft customer and one large external customer have both asked for this to be fixed as soon as possible.
The WPF team has been working with both customers to reduce their build times. Customers tested instrumented builds of our markup compiler with earlier versions of this fix to identify causes of unnecessary temporary target assembly builds. Replacing GetHashCode fixed the majority of the incremental build issues for both customers. (Accidental file changes during the build was another non-WPF cause.)
Regression?Not from 3.0, but from .NET Framework.
Risk (see taxonomy)Low. The replacement hash function is a port of existing .NET code. This is only called during markup compilation.
Link the PR to the original issue and/or the PR to master.Original Issue:
Building WPF projects is not deterministic with dotnet.exe #3876
Original PR:
Fix incremental build for WPF projects with dotnet.exe #4053
Is there a packaging impact?No.