8

I had an update for Visual Studio 2019 community. I am now on version 16.10.2. But now I can't open my solutions anymore. Existing projects aren't loading and the log says this:

===================== 18-6-2021 08:58:43 Recoverable System.MissingMethodException: Method not found: 'System.Collections.Generic.LinkedListNode1<!0> System.Collections.Generic.LinkedList1.gdt_Last()'. at Microsoft.Build.Evaluation.ProjectRootElementCache.BoostEntryInStrongCache(ProjectRootElement projectRootElement) at Microsoft.Build.Evaluation.ProjectRootElementCache.RenameEntryInternal(String oldFullPathIfAny, ProjectRootElement projectRootElement) at Microsoft.Build.Evaluation.ProjectRootElementCache.AddEntry(ProjectRootElement projectRootElement) at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.OpenLoader(String path, ProjectRootElementCacheBase projectRootElementCache) at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.Open(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded, Nullable1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.Open(String path, ProjectCollection projectCollection, Nullable1 preserveFormatting) at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.Microsoft.VisualStudio.ProjectSystem.IProjectLockReleaser.GetProjectXmlAsync(String projectFile, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.UnconfiguredProjectImpl.<>c__DisplayClass185_0.<<SaveUserFileAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.<ExecuteWithinLockAsync>d__128.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.<ExecuteWithinLockAsync>d__128.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.UnconfiguredProjectImpl.<DisposeAsync>d__174.MoveNext() =================== 18-6-2021 08:58:43 Recoverable System.MissingMethodException: Method not found: 'System.Collections.Generic.LinkedListNode1<!0> System.Collections.Generic.LinkedList1.gdt_Last()'. at Microsoft.Build.Evaluation.ProjectRootElementCache.BoostEntryInStrongCache(ProjectRootElement projectRootElement) at Microsoft.Build.Evaluation.ProjectRootElementCache.RenameEntryInternal(String oldFullPathIfAny, ProjectRootElement projectRootElement) at Microsoft.Build.Evaluation.ProjectRootElementCache.AddEntry(ProjectRootElement projectRootElement) at Microsoft.Build.Construction.ProjectRootElement..ctor(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.OpenLoader(String path, ProjectRootElementCacheBase projectRootElementCache) at Microsoft.Build.Evaluation.ProjectRootElementCache.Get(String projectFile, OpenProjectRootElement openProjectRootElement, Boolean isExplicitlyLoaded, Nullable1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.Open(String path, ProjectRootElementCacheBase projectRootElementCache, Boolean isExplicitlyLoaded, Nullable1 preserveFormatting) at Microsoft.Build.Construction.ProjectRootElement.Open(String path, ProjectCollection projectCollection, Nullable1 preserveFormatting) at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.Microsoft.VisualStudio.ProjectSystem.IProjectLockReleaser.GetProjectXmlAsync(String projectFile, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.UnconfiguredProjectImpl.<>c__DisplayClass185_0.<b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.JoinableTask.d__76.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.d__128.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.ProjectSystem.ProjectLockService.d__128.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.ProjectSystem.UnconfiguredProjectImpl.d__174.MoveNext() ===================

If I start a new solution with a MVC Api the solution is created, but the project is not added. Adding it to the solution manually gives me this error:

Method not found: 'System.Collections.Generic.LinkedListNode1<!0> System.Collections.Generic.LinkedList1.gdt_Last()'

What I tried:

  • Repair Visual Studio
  • Uninstalled Visual Studio and everything that has to do with .NET or Microsoft frameworks
  • Googled (nothing found)

Does anyone have any idea why this happens all of a sudden?

  • "If I start a new solution with a MVC Api the solution is created, but the project is not added" did you add an existing project or a newly created one? – nilsK Jun 18 '21 at 07:15
  • @nilsK I created a new one with the new solution (splash-screen -> Create new project -> Fill all the needing fields). Then I see the solution name in the solution explorer, but not projects. But the project is created on the disk. When I try to add this project to the solution I get the error I mention in the original post –  Jun 18 '21 at 07:30
  • 1
    Wild guess: "method not found" may be because a different framework was used (by VS) than was expected. What .Net versions do you [have installed](https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed)? But I would expect that (re-)installing VS would have taken care of that. – Hans Kesting Jun 25 '21 at 09:32
  • If you are using a NuGet package, check the setting for Package Format (VS menu => Tools => Options => NuGet Package Manager => General => Package Management). Also check that the necessary Workloads and/or Individual Components are installed (Open "Visual Studio Installer", then click "Modify") – Tu deschizi eu inchid Jun 25 '21 at 23:35
  • Apparently you can install Visual Studio versions SxS (side-by-side). https://learn.microsoft.com/en-us/visualstudio/install/install-visual-studio-versions-side-by-side?view=vs-2019. Haven't tried it myself yet – Pieterjan Jun 28 '21 at 08:02
  • I cannot reproduce your issue, could you report it on Developer Community (open Visual Studio > menu > Help > Send Feedback > Report a Problem)? – Mia Wu-MSFT Jul 08 '21 at 08:48

3 Answers3

1

I suspect the newest version of VS2019 updated the solution cache, without backward compatibility or corrupted it. Try to delete the hidden folder .vs in your solution folder and reopen your solution with the VS2019 you want to use.

Soleil
  • 6,404
  • 5
  • 41
  • 61
0

check this solution

open .csproj and remove this tag

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> bla-bla </Target>
Shaybakov
  • 618
  • 7
  • 9
  • I don't have this target in my projects. Solution in the link is not the solution for my problem. –  Jun 21 '21 at 06:46
0

Here is my 2¢:

  1. If your project has NuGet packages, examine and update each one properly.
  2. I'm not sure that you have the latest version of .Net which is recently 5. What happened when you get System.Collections.dll and replace it with the correlated .dll file having the same name. For example, the dll is in C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0 in my computer.

However, I think when you update your framework to .Net 5 along with updating related NuGet packages fixes the issue.

How to change the project version?

Right click on project, Properties --> Application --> Target framework. Target framework dropdown displays list of frameworks installed on your machine. If you don't want to update it, at least take .Net 5 and make the version down in the dropdown menu.

enter image description here enter image description here

  • Thanks for the reply. Sadly I cannot open my solutions and projects aren't loaded, as stated in the original post. I can however edit the csproj. I do have .NET 5.0 installed (as soon as it was released), together with .NET Core 3.1 (which all my projects are currently using). This solution does not work for my problem. –  Jun 21 '21 at 06:44
  • Check your nuget packages’ version by hand in csproj files – Soner from The Ottoman Empire Jun 21 '21 at 07:15