Skip to content

Conversation

@ryalanms
Copy link
Member

@ryalanms ryalanms commented Jan 28, 2021

Description

[release/3.1] 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 Impact

One 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.

Co-authored-by: Michael Dietrich <michael1.dietrich@zeiss.com>
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Jan 28, 2021
@ghost ghost requested review from SamBent and fabiant3 January 28, 2021 04:20
@ryalanms
Copy link
Member Author

Validated .NET upgrade scenario, as requested by .NET Tactics. The project always rebuilds when changing the version of PresentationBuildTasks.

@ryalanms ryalanms merged commit 7ababcd into release/3.1 Jan 28, 2021
@wtgodbe
Copy link
Member

wtgodbe commented Jan 28, 2021

@ryalanms this branch isn't open for check-in right now, please make sure that servicing branches are open before checking into them in the future (no harm in this case, as dependency flow is currently off, but early check-ins can cause problems)

@vishalmsft vishalmsft deleted the servicing.hash.3.1 branch February 10, 2022 06:03
@ghost ghost locked as resolved and limited conversation to collaborators Apr 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage Servicing-approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants