dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.85k stars 4.01k forks source link

Failed to load solution in parallel #30096

Closed EVTrifonov closed 1 year ago

EVTrifonov commented 5 years ago

Version 2.9.0: Trying to load several solutions in parallel

await Task.WhenAll(new string[]
{
    "a.sln",
    "b.sln",
    "c.sln"
}
.AsParallel()
.Select(p =>
{
    var workspace = MSBuildWorkspace.Create();
    return workspace.OpenSolutionAsync(p);
}));

Loading failed with exception.

System.InvalidOperationException
The operation cannot be completed because a build is already in progress.

There is no such issue using version 2.8.2.

CyrusNajmabadi commented 1 year ago

@EVTrifonov is this still an issue for you?

EVTrifonov commented 1 year ago

@CyrusNajmabadi, looks like it is not.

CyrusNajmabadi commented 1 year ago

Thanks!

CEbbinghaus commented 1 year ago

I am still getting this error:

Fatal Exception occured: System.InvalidOperationException: The operation cannot be completed because a build is already in progress.
   at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
   at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName)
   at Microsoft.Build.Execution.BuildManager.RequireState(BuildManagerState requiredState, String exceptionResouorce)
   at Microsoft.Build.Execution.BuildManager.BeginBuild(BuildParameters parameters)
   at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild(IDictionary`2 globalProperties)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(String solutionFilePath, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(String solutionFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
   at WTG.RoslynAnalysisMiner.DiagnosticRetriever.RetrieveFromSln(String Path, CancellationToken cancellationToken) in C:\Users\ChrisRob.Ebbinghaus\Projects\WTG.RoslynAnalysisMiner\src\WTG.RoslynAnalysisMiner\DiagnosticRetriever.cs:line 121
   at Diagnostics.FromTarget(String targetPath, GeneratorOptions options, ILogger logger, Boolean includeSuppressed, CancellationToken cancellationToken) in C:\Users\ChrisRob.Ebbinghaus\Projects\SuppTest\src\DiagnosticGenerator.cs:line 50
   at RoslynAnalysisExtractor.Commands.Extract.<>c__DisplayClass2_1.<<CollectDiagnostics>b__2>d.MoveNext() in C:\Users\ChrisRob.Ebbinghaus\Projects\SuppTest\src\Commands\Extract.cs:line 76

Should I open a separate Issue?