Shamshiel
Shamshiel

Reputation: 2211

Visual Studio 2017 crashes when opening certain solution

I have a solution that works fine in VS2015 that I can't open with the new version of Visual Studio 2017 (15.0.0+26228.12).

This seems to be the problem according to the Windows "Event Viewer": The project already transitively references the target project.

Here the full stacktrace:

StreamJsonRpc.RemoteInvocationException: The project already transitively references the target project.
   bei Microsoft.CodeAnalysis.SolutionState.CheckNotContainsTransitiveReference(ProjectId fromProjectId, ProjectId toProjectId)
   bei Microsoft.CodeAnalysis.SolutionState.AddProjectReference(ProjectId projectId, ProjectReference projectReference)
   bei Microsoft.CodeAnalysis.Solution.AddProjectReference(ProjectId projectId, ProjectReference projectReference)
   bei Microsoft.CodeAnalysis.Project.AddProjectReference(ProjectReference projectReference)
   bei Microsoft.CodeAnalysis.Workspace.UpdateReferencesAfterAdd(Solution solution)
   bei Microsoft.CodeAnalysis.Workspace.UpdateReferencesAfterAdd()
   bei Microsoft.CodeAnalysis.Remote.RemoteWorkspace.AddSolution(SolutionInfo solutionInfo)
   bei Microsoft.CodeAnalysis.Remote.SolutionService.<UpdatePrimaryWorkspace_NoLockAsync>d__11.MoveNext()

The solution is quite complex and changing it with a text editor to find the project that causes the issue feels like searching for a needle in a haystack.

Does somebody know this error and could point me in the right direction? Maybe I have to look at a certain part in my solution to find the error?

Upvotes: 1

Views: 1116

Answers (1)

Shamshiel
Shamshiel

Reputation: 2211

I fixed the problem by slowly searching for the problematic project in the solution and then deleting the transitively reference.

First I opened the solution in a text editor (like Notepad++) and deleted a bunch of projects. Then I opened the solution in VS2017 to see if it crashes again. If it didn't crash I found the margin of projects that could be problematic. After that I added one project after the other back in the solution via the text editor. Every time I did that I had to restart VS2017 to see if it crashes again.

After I identified the problematic project I opened the unmodified solution in VS2015 and looked at the references of this project. In my case it was easy to see what reference was problematic. After I deleted this problematic reference the project opened with no problems in VS2017.

Upvotes: 1

Related Questions