未验证 提交 8bbef3aa 编写于 作者: M Manish Vasani 提交者: GitHub

Merge pull request #39973 from mavasani/WorkCoordinatorShouldRespectRunAnalyzers

Ensure that work coordinator sees change to "RunAnalyzers" project pr…
......@@ -365,6 +365,36 @@ internal async Task Project_OutputRefFilePath_Change(BackgroundAnalysisScope ana
Assert.Equal(expectedDocumentEvents, worker.DocumentIds.Count);
}
[InlineData(BackgroundAnalysisScope.ActiveFile, false, 0)]
[InlineData(BackgroundAnalysisScope.ActiveFile, true, 1)]
[InlineData(BackgroundAnalysisScope.OpenFilesAndProjects, false, 5)]
[InlineData(BackgroundAnalysisScope.FullSolution, false, 5)]
[Theory]
internal async Task Project_RunAnalyzers_Change(BackgroundAnalysisScope analysisScope, bool firstDocumentActive, int expectedDocumentEvents)
{
using var workspace = WorkCoordinatorWorkspace.CreateWithAnalysisScope(analysisScope, SolutionCrawler);
var solutionInfo = GetInitialSolutionInfo_2Projects_10Documents(workspace);
workspace.OnSolutionAdded(solutionInfo);
var project = workspace.CurrentSolution.Projects.First(p => p.Name == "P1");
if (firstDocumentActive)
{
MakeFirstDocumentActive(project);
}
await WaitWaiterAsync(workspace.ExportProvider);
Assert.True(project.State.RunAnalyzers);
var newSolution = workspace.CurrentSolution.WithRunAnalyzers(project.Id, false);
var worker = await ExecuteOperation(workspace, w => w.ChangeProject(project.Id, newSolution));
project = workspace.CurrentSolution.GetProject(project.Id);
Assert.False(project.State.RunAnalyzers);
Assert.Equal(expectedDocumentEvents, worker.SyntaxDocumentIds.Count);
Assert.Equal(expectedDocumentEvents, worker.DocumentIds.Count);
}
[Fact]
public async Task Test_NeedsReanalysisOnOptionChanged()
{
......
......@@ -575,7 +575,8 @@ private async Task EnqueueProjectConfigurationChangeWorkItemAsync(ProjectChanges
!object.Equals(oldProject.AnalyzerOptions, newProject.AnalyzerOptions) ||
!object.Equals(oldProject.DefaultNamespace, newProject.DefaultNamespace) ||
!object.Equals(oldProject.OutputFilePath, newProject.OutputFilePath) ||
!object.Equals(oldProject.OutputRefFilePath, newProject.OutputRefFilePath))
!object.Equals(oldProject.OutputRefFilePath, newProject.OutputRefFilePath) ||
oldProject.State.RunAnalyzers != newProject.State.RunAnalyzers)
{
projectConfigurationChange = projectConfigurationChange.With(InvocationReasons.ProjectConfigurationChanged);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册