phmonte / Buildalyzer

A utility to perform design-time builds of .NET projects without having to think too hard about it.
MIT License
589 stars 92 forks source link

use AddToWorkspace throw Exception System.ArgumentException:The specified sequence has duplicates parameter name projectReferences[11] #180

Closed benxionghu closed 4 months ago

benxionghu commented 3 years ago

AnalyzerManager manager = new AnalyzerManager(files[0]); analyzer.AddToWorkspace(workspace); exception message: System.ArgumentException:The specified sequence has duplicates parameter name projectReferences[11] 在 Microsoft.CodeAnalysis.PublicContract.ThrowArgumentItemNullOrDuplicateException[T](IEnumerable1 sequence, String argumentName) 位置 /_/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/PublicContract.cs:行号 150 在 Microsoft.CodeAnalysis.ProjectInfo.Create(ProjectId id, VersionStamp version, String name, String assemblyName, String language, String filePath, String outputFilePath, CompilationOptions compilationOptions, ParseOptions parseOptions, IEnumerable1 documents, IEnumerable1 projectReferences, IEnumerable1 metadataReferences, IEnumerable1 analyzerReferences, IEnumerable1 additionalDocuments, Boolean isSubmission, Type hostObjectType, String outputRefFilePath) 位置 /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs:行号 220 在 Buildalyzer.Workspaces.AnalyzerResultExtensions.GetProjectInfo(IAnalyzerResult analyzerResult, Workspace workspace, ProjectId projectId) 在 Buildalyzer.Workspaces.AnalyzerResultExtensions.AddToWorkspace(IAnalyzerResult analyzerResult, Workspace workspace, Boolean addProjectReferences) Why does this happen?

phmonte commented 4 months ago

Hello, does the problem still happen with the new versions?

phmonte commented 4 months ago

Closing the issue due to lack of feedback, if the problem persists, please open a new one.