Restore not re-generating project.assets.json #12437
Labels
Functionality:Restore
Partner:DotNet
Status:No recent activity
No recent activity.
Style:PackageReference
Type:Bug
NuGet Product Used
MSBuild.exe
Product Version
msbuild 17.5
Worked before?
msbuild 17.4 (caveats below)
Impact
I'm unable to use this version
Repro Steps & Context
This is an involved discussion that is hard to boil down to a simple repro. Have lots of internal data, logs, etc ... to help track this down. Whomever ends up looking at this can reach me internally at jaredpar@microsoft.com and I can help walk you through the situation if this isn't clear.
The rough order of events happening is the following.
msbuild.exe /t:restore Roslyn.sln
.msbuild.exe /restore src\NuGet\Microsoft.Net.Compilers.Toolset\AnyCpu\Microsoft.Net.Compilers.Toolset.Package.csproj
msbuild.exe /t:Clean src\NuGet\Microsoft.Net.Compilers.Toolset\AnyCpu\Microsoft.Net.Compilers.Toolset.Package.csproj
msbuild.exe /t:build /restore /p:BootstrapBuildPath=D:\a\_work\1\s\artifacts\Bootstrap Roslyn.sln
The actual commands are significantly more involved (included in verbose section) but that is the gist of commands. The key is the presence of
/p:BootstrapBuildPath
. When this is empty then every project in the solution will have a reference toMicrosoft.Net.Compilers.Toolset
(source).The practical end effect here is that the project.assets.json file produced in step 1 and 2 should be different than the one produced in step 4 as the
<PackageReference>
set is different. The vast majority of projects do restore this way and show the correct values. The bug is that on every run there are a few projects that do not do this and end up with the version from step 1/2. This results in build breaks for us.The easiest demonstration of this behavior is the PR: dotnet/roslyn#66864.
Notice that when we use commit b8ffff the build fails with
ValidateBootstrap
errors (this means restore failed). This failure will go away if we do either of the following:obj
andbin
directories. This forces all project.assets.json files to be regenerated and they are done so correctly. To us this suggests there is some timestamp / caching bug at play here.msbuild.exe
command. I have no explanation for this but it's very easy to demonstrate.This is very hard to reproduce locally. To the point we've not been able to successfully do it. We've only been able to observe this via CI but it reproduces 100% there.
It's unclear how long this bug has existed. What spawned this investigation is our response to #12373 was to delete static graph restore from our pipelines. The moment we did that we started running into this bug. After a few days of investigation we decided to combine steps 1 and 2 together on a whim and the issue went away. It's taken another week of digging to get to this particular point.
Please let us know if you need any other data to help track this down, we have lots.
Verbose Logs
The associated binlogs for each command are available in the published artifacts. Contact me if the artifacts have expired as I have local copies.
The text was updated successfully, but these errors were encountered: