-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Improve build reliability #20760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve build reliability #20760
Conversation
@wtgodbe I dug this out of my work to eliminate most *.Manual.cs files in the 'release/3.1' branch. Sorry that it took me a while to remember I'd seen strange cases in which |
@@ -144,7 +144,7 @@ | |||
This executes on NuGet restore and during DesignTimeBuild. It should not run in the outer, cross-targeting build. | |||
--> | |||
<Target Name="ResolveCustomReferences" | |||
BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" | |||
BeforeTargets="CheckForImplicitPackageReferenceOverrides;CollectPackageReferences;ResolvePackageAssets" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/fyi there were two things wrong w/ the old BeforeTargets
value:
ResolveAssemblyReferencesDesignTime
didn't matter because that depends onResolveAssemblyReferences
ResolveAssemblyReferences
runs later (closer toCoreCompile
) than needed to ensure information needed from packages is available where / when it needs to be
<ProjectReference Include="$(_ReferenceProjectFile)"> | ||
<OutputItemType>ReferenceProjectMetadata</OutputItemType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/fyi depending on %(OutputItemType)
metadata works most of the time but requires the ref/ project to build in some contexts where it isn't. This is more important when doing ApiCompat checks but might help in general.
@dougbu you are a superhero! Looking forward to hearing the explanation of this one on Monday |
@wtgodbe no heroes here, especially because template tests are failing. (Did you kick off a retry? That produced the same 11/29 template test failures as the first try.) @markwilkie why does Arcade use 42.42.42.42 as the default assembly version in non-official builds? Because the dotnet/aspnetcore infrastructure chooses 3.1.0.0 for ref/ assemblies, we end up with implementation assemblies that are incompatible i.e. implementation assemblies have a much higher assembly version. Actually a bit surprising this works at all in our test projects. But, the version change and a mix of .NET Core assemblies that build against ref/ assemblies with .NET Standard assemblies that don't explains the template test failures. Is there a major downside to setting If changing |
/fyi https://dev.azure.com/dnceng/public/_build/results?buildId=597609 was the build that failed multiple template tests due to incompatible assembly versions. |
https://dev.azure.com/dnceng/public/_build/results?buildId=597668 shows Not sure why yet but most if not all template test failures involve Microsoft.AspNetCore.SpaServices.Extensions, Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore, or Microsoft.AspNetCore.ApiAuthorization.IdentityServer failing to load multiple versions of Microsoft.AspNetCore.Http.Abstractions or Microsoft.AspNetCore.ApiAuthorization.IdentityServer failing to load multiple versions of Microsoft.AspNetCore.Authentication. |
Using an artificial version number that's higher than any version we will ship to discover issues where a binding redirect is missing or some code uses a hard-coded version. This artificial version number makes version mismatches more obvious earlier.
Yes, this property should not be set in targets/props files. It's there to provide a local override in case a dev wants to build private bits with the right versions locally. It should not be a permanent setting. |
Thanks for the added information @markwilkie and @tmat. It turns out I can't turn off the 42.42.42.42 assembly versioning without significant hacks. I've reproduced the problem locally and will let this PR sit 'til I have a working fix. Suspect the issue is a missing workaround in our template tests. Those tests run without the Arcade SDK and the majority of our infrastructure. And, the problem shows up more clearly in this PR because the build is more consistent now. |
Example of template failures:
Will look locally |
This is apparently a problem in how a few of the projects are built, not something in the templates or the tests. For example, the references in Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll are incorrect for Microsoft.AspNetCore.Http.Abstractions:
My reliability improvement is insufficient. Digging… |
Root cause is the src/ project's (The branch I pulled the change from doesn't multi-target ref/ projects, avoiding this issue.) |
- ensure `ResolveCustomReferences` target executes before packages are used - `ResolveAssemblyReferences` and `ResolveAssemblyReferencesDesignTime` targets run too late - e.g. failed builds of Microsoft.AspNetCore.WebUtilities or Microsoft.AspNetCore.Hosting when building from root - add `GetReferenceProjectTargetPathMetadata` for ease of use as well as reliability - avoids extra work to get existing metadata (ref/ projects execute no tasks in this target) nit: rename `@(ReferenceProjectMetadata)` -> `@(ReferenceProjectTargetPathMetadata)`
- ref/ projects all multi-target and otherwise no-op this target
bd63964
to
12a5c49
Compare
- change is no longer needed with other fixes in this PR This reverts commit 8218d6e.
I think we should hold off on this for 3.1.5, given that it doesn't strictly fix a bug, but rather is a more desirable solution to a bug we've already "fixed" - and we are relatively close to getting a build for 3.1.4 already |
I agree, though I think we need to be extra careful to validate the dependencies of our packages in 3.1.4 to make sure nothing changed. |
Sounds like a plan. Anyone already have a script that runs through two sets of .nupkg files and compares the contained .nuspec? |
Any objection to creating the 3.1.5 milestone? |
I did a good amount of manual validation on my fix - the references in stuff I checked in the shared framework & in a few packages looked good, but I didn't programmatically validate everything |
Back to this PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, assuming assembly references look good locally compared to 3.1.3
I think you mean 3.1.5, right? Fine with me. For my understanding, this has always been a race condition and we got lucky, or...? |
Yes, 3.1.5
Right, it's always been a race condition. |
- ensure `ResolveCustomReferences` target executes before packages are used - `ResolveAssemblyReferences` and `ResolveAssemblyReferencesDesignTime` targets run too late - e.g. failed builds of Microsoft.AspNetCore.WebUtilities or Microsoft.AspNetCore.Hosting when building from root (ports a small part of #20760 to master)
- ensure `ResolveCustomReferences` target executes before packages are used - `ResolveAssemblyReferences` and `ResolveAssemblyReferencesDesignTime` targets run too late - e.g. failed builds of Microsoft.AspNetCore.WebUtilities or Microsoft.AspNetCore.Hosting when building from root (ports a small part of #20760 to master)
ResolveCustomReferences
target executes before packages are usedResolveAssemblyReferences
andResolveAssemblyReferencesDesignTime
targets run too lateGetReferenceProjectTargetPathMetadata
for ease of use as well as reliabilitynit: rename
@(ReferenceProjectMetadata)
->@(ReferenceProjectTargetPathMetadata)