public async IAsyncEnumerable BuildProjectIncremental()

in src/Analysis/Codelyzer.Analysis.Build/WorkspaceBuilderHelper.cs [64:104]


        public async IAsyncEnumerable<ProjectAnalysisResult> BuildProjectIncremental()
        {
            if (IsSolutionFile())
            {
                using (SemaphoreSlim concurrencySemaphore = new SemaphoreSlim(1))
                {
                    string solutionFilePath = NormalizePath(WorkspacePath);
                    SolutionFile solutionFile = SolutionFile.Parse(solutionFilePath);
                    foreach (var project in solutionFile.ProjectsInOrder)
                    {
                        string projectPath = project.AbsolutePath;
                        if (IsProjectFile(project))
                        {
                            // if it is part of analyzer manager
                            concurrencySemaphore.Wait();
                            var result = await Task.Run(() =>
                            {
                                try
                                {
                                    return RunTask(projectPath);
                                }
                                finally
                                {
                                    concurrencySemaphore.Release();
                                }
                            });
                            yield return result;
                        }                      
                    }
                }
            }
            else
            {
                yield return BuildIncremental(WorkspacePath);
            }

            Logger.LogDebug(_sb.ToString());
            _writer.Flush();
            _writer.Close();
             ProcessLog(_writer.ToString());
        }