-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Description
Instead of gracefully handling the error case when there are duplicate project guids, as VS and MSBuild have done in the past, the new solution parser throws in these scenarios.
Historical context for why Roslyn is testing this scenario: https://vstfdevdiv.corp.microsoft.com/DevDiv2/DevDiv/_workitems/edit/552981.
This is getting triggered by MSBuild switching to the solutionpersistence parser.
Repro
- Checkout https://github.com/dotnet/roslyn/tree/6e36c969b3a4dbee0e966ee131e1754ff98b6115.
- Run this test: https://github.com/dotnet/roslyn/blob/6e36c969b3a4dbee0e966ee131e1754ff98b6115/src/Workspaces/MSBuildTest/VisualStudioMSBuildWorkspaceTests.cs#L199-L207
Expected Behavior
Graceful handling of the duplicate project guid.
Actual Behavior
Microsoft.Build.Exceptions.InvalidProjectFileException : The project file could not be loaded. System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionException: Duplicate item 'c71872e2-0d54-4c4e-b6a9-8c1726b7b78c' of type 'SolutionProjectModel'.
Parameter name: value ---> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionArgumentException: Duplicate item 'c71872e2-0d54-4c4e-b6a9-8c1726b7b78c' of type 'SolutionProjectModel'.
Parameter name: value
at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionItemModel.set_Id(Guid value)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ReadProjectInfo(SolutionModel solution, StringTokenizer& tokenizer)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ParseAsync(ISolutionSerializer serializer, String fullPath, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ParseAsync(ISolutionSerializer serializer, String fullPath, CancellationToken cancellationToken)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.<ReadModelAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SingleFileSerializerBase1.<Microsoft-VisualStudio-SolutionPersistence-ISolutionSerializer-OpenAsync>d__11.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.Build.Construction.SolutionFile.ParseUsingNewParser()
---> (Inner Exception #0) Microsoft.VisualStudio.SolutionPersistence.Model.SolutionException: Duplicate item 'c71872e2-0d54-4c4e-b6a9-8c1726b7b78c' of type 'SolutionProjectModel'.
Parameter name: value ---> Microsoft.VisualStudio.SolutionPersistence.Model.SolutionArgumentException: Duplicate item 'c71872e2-0d54-4c4e-b6a9-8c1726b7b78c' of type 'SolutionProjectModel'.
Parameter name: value
at Microsoft.VisualStudio.SolutionPersistence.Model.SolutionItemModel.set_Id(Guid value)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ReadProjectInfo(SolutionModel solution, StringTokenizer& tokenizer)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ParseAsync(ISolutionSerializer serializer, String fullPath, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.Reader.ParseAsync(ISolutionSerializer serializer, String fullPath, CancellationToken cancellationToken)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SlnV12.SlnFileV12Serializer.<ReadModelAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.SolutionPersistence.Serializer.SingleFileSerializerBase`1.<Microsoft-VisualStudio-SolutionPersistence-ISolutionSerializer-OpenAsync>d__11.MoveNext()<---
T:\RoslynTests\debef9eb-3e52-4f12-bb95-c3d85526bc10\DuplicatedGuids.sln
Metadata
Metadata
Assignees
Labels
No labels