dotnet restore
fails to invalidate lock file and produce puzzling error messages
#14198
Labels
Area:RestoreRepeatableBuild
The lock file features
Category:Quality Week
Issues that should be considered for quality week
Functionality:Restore
Priority:2
Issues for the current backlog.
Product:dotnet.exe
Type:Bug
Directory.Packages.props:
global.json:
nuget.config:
nuget_restore.csproj:
Restore project:

Bump ReactiveUI to 20.2.45: Directory.Packages.props:
Restore project:

Allow System.Text.Json in PackageSourceMapping: nuget.config:
Restore project:

Cleanup and restore project:

Bump System.Text.Json to 9.0.3: Directory.Packages.props:
Restore project:

Cleanup and restore project:

Remove lock file and restore project:

As I understand, what is happened here:
First failed restore (one that error out because System.Text.Json was not added to PackageSourceMapping), regardless of error, still update content of lock file. Any following restores with that lock file, thinks that that lock file is current to the project, as no versions of packages in the project was updated, compared to lock file. That make
dotnet restore
to skip building dependency graph, and instead read it from lock file. Which forcedotnet restore
to repeat the failure of not able to resolve System.Text.Json package. Lock file, that represent failed restore, shoud not be considered to be current to project.The text was updated successfully, but these errors were encountered: