Skip to content
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

Random error: Failed to resolve SDK 'package/version'. Package restore was successful but a package with the ID of "package" was not installed. #10935

Open
rolfbjarne opened this issue Jun 10, 2021 · 3 comments
Labels
Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Triage:NeedsMoreInfo Type:Bug

Comments

@rolfbjarne
Copy link

Details about Problem

NuGet product used (NuGet.exe | Visual Studio | MSBuild.exe | dotnet.exe): dotnet

Product version: 6.0.100-preview.6.21280.2

Worked before? Don't know, this logic that runs into this problem is fairly new for us.

Repro steps and/or sample project

There are no repro steps, because it's random.

We see it somewhat frequently on CI, and trying again usually helps (but not always). It breaks our builds whenever it happens, so it's quite visible 😐

It might be related to running multiple dotnet processes in parallel. In fact some of these processes (they all do basically the same thing, just slightly different input) succeed, some fail.

Verbose Logs

This is a collection of binlogs (of all the dotnet processes that ran in parallel):

nupkgs.zip

The larger ones succeeded, the smaller ones didn't:

$ unzip -l *.zip
Archive:  nupkgs.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  06-10-2021 21:47   nupkgs/
   339955  06-10-2021 19:47   nupkgs/Microsoft.iOS.Windows.Sdk.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
    36209  06-10-2021 19:47   nupkgs/Microsoft.iOS.Runtime.ios-arm.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
   339489  06-10-2021 19:47   nupkgs/Microsoft.iOS.Runtime.ios-arm64.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
    36218  06-10-2021 19:47   nupkgs/Microsoft.iOS.Runtime.iossimulator-x86.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
   339409  06-10-2021 19:47   nupkgs/Microsoft.tvOS.Runtime.tvossimulator-x64.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
    36194  06-10-2021 19:47   nupkgs/Microsoft.iOS.Runtime.iossimulator-x64.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
    36192  06-10-2021 19:47   nupkgs/Microsoft.tvOS.Runtime.tvos-arm64.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
---------                     -------
  1163666                     8 files

Example output from one of the failed ones:

$ dotnet build /v:diag Microsoft.iOS.Runtime.ios-arm.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
[...]
                   Resolving SDK 'Microsoft.DotNet.SharedFramework.Sdk/6.0.0-beta.21212.6'...
                   Running restore with 12 concurrent jobs.
                   Reading project file /var/folders/fk/l5v9vv0j6rggmfsjkz3cx6qw0000gn/T/NuGetScratch/e57bdd7b09cc43f9bb34ca63ce9071a5/d209b53f765847c49af9dcffc2e71103.proj.
                   Restoring packages for /var/folders/fk/l5v9vv0j6rggmfsjkz3cx6qw0000gn/T/NuGetScratch/e57bdd7b09cc43f9bb34ca63ce9071a5/d209b53f765847c49af9dcffc2e71103.proj...
                   Restoring packages for .NETStandard,Version=v0.0...
                   Resolving conflicts for .NETStandard,Version=v0.0...
                   Checking compatibility of packages on .NETStandard,Version=v0.0.
                   Checking compatibility for d209b53f765847c49af9dcffc2e71103 1.0.0 with .NETStandard,Version=v0.0.
                   Checking compatibility for Microsoft.DotNet.SharedFramework.Sdk 6.0.0-beta.21212.6 with .NETStandard,Version=v0.0.
                   All packages and projects are compatible with .NETStandard,Version=v0.0.
15:07:26.328     0>/Users/builder/azdo/_work/1/s/xamarin-macios/dotnet/package/common.csproj(52,3): error : Failed to resolve SDK 'Microsoft.DotNet.SharedFramework.Sdk/6.0.0-beta.21212.6'. Package restore was successful but a package with the ID of "Microsoft.DotNet.SharedFramework.Sdk" was not installed.

it looks like the succeeding ones took a different code path:

$ dotnet build /v:diag Microsoft.iOS.Runtime.ios-arm64.14.5.100-ci.pr.gh11893.1002+sha.ab99eec6b.nupkg.binlog
[...]
                   Resolving SDK 'Microsoft.DotNet.SharedFramework.Sdk/6.0.0-beta.21212.6'...
                   Importing project "/Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/Sdk/Sdk.props" into project "/Users/builder/azdo/_work/1/s/xamarin-macios/dotnet/package/common.csproj" at (52,3).
                   Importing project "/Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/targets/Microsoft.DotNet.SharedFramework.Sdk.props" into project "/Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/Sdk/Sdk.props" at (24,3).
                   Importing project "/Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/targets/sharedfx.props" into project "/Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/targets/Microsoft.DotNet.SharedFramework.Sdk.props" at (2,3).
                   Property reassignment: $(NoWarn)="1701;1702;NU5105;NU5128;NU5131;NU5128;NU5131" (previous value: "1701;1702;NU5105;NU5128;NU5131") at /Users/builder/.nuget/packages/microsoft.dotnet.sharedframework.sdk/6.0.0-beta.21212.6/targets/sharedfx.props (13,5)
                   Importing project "/Users/builder/azdo/_work/1/s/xamarin-macios/builds/downloads/dotnet-sdk-6.0.100-preview.6.21280.2-osx-x64/sdk/6.0.100-preview.6.21280.2/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.targets" into project "/Users/builder/azdo/_work/1/s/xamarin-macios/dotnet/package/Microsoft.iOS.Runtime.ios-arm64/package.csproj" at (0,0).
                   Project "$(MSBuildThisFileDirectory)../targets/Microsoft.NET.Sdk.BeforeCommonCrossTargeting.targets" was not imported by "/Users/builder/azdo/_work/1/s/xamarin-macios/builds/downloads/dotnet-sdk-6.0.100-preview.6.21280.2-osx-x64/sdk/6.0.100-preview.6.21280.2/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.targets" at (19,3), due to false condition; ('$(IsCrossTargetingBuild)' == 'true') was evaluated as ('' == 'true').
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue Jun 10, 2021
We randomly run into a NuGet restore failure, which breaks the build, and is
quite annoying.

This might be due to a problem with multiple simultaneous restores, so this is
an attempt to first restore the packages we need, in a single serialized
restore, and once that's done we can process everything else in parallel.

Ref: xamarin/maccore#2427
Ref: NuGet/Home#10935
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue Jun 11, 2021
)

We randomly run into a NuGet restore failure, which breaks the build, and is
quite annoying.

This might be due to a problem with multiple simultaneous restores, so this is
an attempt to first restore the packages we need, in a single serialized
restore, and once that's done we can process everything else in parallel.

Ref: xamarin/maccore#2427
Ref: NuGet/Home#10935
@nkolev92 nkolev92 added the Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team label Jun 16, 2021
@nkolev92
Copy link
Member

Hey @rolfbjarne

We have had issues like this in the past, #7817, but it seems like they were supposed to fixed.

cc @jeffkl

@jeffkl
Copy link
Contributor

jeffkl commented Jun 16, 2021

@nkolev92 the output is very different in the success case versus the failure case.

Failure

image

Success

image

It does look like the restores are all happening at the same time and the locking is keeping them from all restoring the same package. But once the lock is released the package isn't there?

@rolfbjarne what's the repository this is happening in? I'd like to look at the customized logic in use.

@rolfbjarne
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:2 Issues for the current backlog. Product:MSBuildSDKResolver The NuGet powered SDK resolver. Owned by MSBuild team Triage:NeedsMoreInfo Type:Bug
Projects
None yet
Development

No branches or pull requests

4 participants