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

Assets from packages are missing after restore #5995

Closed
emgarten opened this issue Oct 6, 2017 · 10 comments
Closed

Assets from packages are missing after restore #5995

emgarten opened this issue Oct 6, 2017 · 10 comments
Assignees
Labels
Functionality:Restore Priority:1 High priority issues that must be resolved in the current sprint. Type:Bug
Milestone

Comments

@emgarten
Copy link
Member

emgarten commented Oct 6, 2017

Some users have reported that after restoring assets such as System.Runtime are missing from the assets file.

This is potentially caused by restore happening while the fallback folder is still being created. The problem is made much worse by how restore reuses file lists from previous restores for the next restore. To improve this experience restore should read the files from disk each time instead of from the previous assets file.

Note that if the fallback folder from the CLI is corrupt then this should be fixed there also.

See: dotnet/core#920

@emgarten emgarten added Functionality:Restore Priority:1 High priority issues that must be resolved in the current sprint. labels Oct 6, 2017
@emgarten emgarten added this to the Backlog milestone Oct 6, 2017
@Petermarcu
Copy link

Looks like this is getting hit by lots of users. dotnet/core#1006 is another issue with multiple people saying they hit it.

@Petermarcu
Copy link

Perhaps another ref count? dotnet/standard#528

@Petermarcu
Copy link

Another customer fixed with clearing the cache dotnet/standard#439 (comment). Almost gave up on .NET Core.

@Petermarcu
Copy link

/cc @rrelyea

I'm not sure if they are all root caused in this issue or not but I'm seeing quite a trend of issues that appear to be cache corruption. Is this something we can try to get into the next possible NuGet update?

@Inumedia
Copy link

Hi, I think this is related to the issue being described here?

After running dotnet restore, I did dotnet run and got thousands of lines of:
error CS0518: Predefined type 'System.Object' is not defined or imported and various other System types.

Here's what the dotnet restore and the beginning of my dotnet run produces:
image

Here is the csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="morelinq" Version="2.8.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
  </ItemGroup>

</Project>

I've also tried running dotnet nuget locals all -c and repeating, giving the same results.

@Petermarcu
Copy link

Let's use this issue to also track this one: dotnet/core#1028

@emgarten emgarten modified the milestones: Backlog, 4.5 Oct 18, 2017
@emgarten emgarten assigned emgarten and unassigned mishra14 Oct 18, 2017
emgarten added a commit to NuGet/NuGet.Client that referenced this issue Oct 19, 2017
Read the list of package files from disk instead of from the previous assets file. This is done to avoid persisting bad data between restores.

Fixes NuGet/Home#5995
emgarten added a commit to NuGet/NuGet.Client that referenced this issue Oct 20, 2017
Rename LocalNuspecCache to LocalPackageFileCache, this will now include the list of files from packages and the contents of the SHA512 file. Read the list of package files from the file cache instead of using the previous lock file to get the package file list.

Fixes NuGet/Home#5995
Fixes NuGet/Home#6062
emgarten added a commit to NuGet/NuGet.Client that referenced this issue Oct 20, 2017
Rename LocalNuspecCache to LocalPackageFileCache, this will now include the list of files from packages and the contents of the SHA512 file. Read the list of package files from the file cache instead of using the previous lock file to get the package file list.

Fixes NuGet/Home#5995
Fixes NuGet/Home#6062
emgarten added a commit to NuGet/NuGet.Client that referenced this issue Oct 20, 2017
Read the list of package files from disk instead of from the previous assets file. This is done to avoid persisting bad data between restores.

Fixes NuGet/Home#5995
danter added a commit to danter/reversi that referenced this issue Apr 29, 2018
Building always fails on the first compile, most likely
related to NuGet/Home#5995
@bjorn-ali-goransson
Copy link

bjorn-ali-goransson commented Jul 3, 2019

FWIW, a restart did it for me. $user$.nuget\packages was inaccessible, couldn't even open it in explorer, so I did a restart and built and viola. 🎻

oh, and deleting C:\Program Files\dotnet\sdk\NuGetFallbackFolder did nothing.

@moonboy13
Copy link

Hey guys, after the latest release of visual studio this week for .NET Core 5.0 this issue is coming back up. The remediation steps given here and in the linked posts are allowing us to keep limping along, but it is pretty arduous to have to continuously delete the obj folder and rebuild.

We are running on a Windows 7 professional instance due to a legacy component of our build, if that has any bearing on the problem. Let me know if you need any other diagnostics or would like me to open a new issue on this.

@aortiz-msft
Copy link
Contributor

@moonboy13 - Yes, it would be great if you could open a new issue with specific repro steps that we can try out.

@aabhishek1
Copy link

Could anyone please let me know what is the fix for this. I am getting the same kind of error when upgrading my project from .net4.8 to .net8.0.

Error Message:- "Package 'Microsoft.AspNet.Identity.Core 2.2.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0'. This package may not be fully compatible with your project."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Priority:1 High priority issues that must be resolved in the current sprint. Type:Bug
Projects
None yet
Development

No branches or pull requests

9 participants