Skip to content

Commit

Permalink
add output paths as one of causes to reanalyze solution cralwer. (#31181
Browse files Browse the repository at this point in the history
)

output paths are not specifically affecting semantics of code but some analyzer such as source based test discovery requires it to generate correct data. so they want to be re-analyzed when those are changed as well.

since output path are rarely get changed. decide to add it as one of cause to reanalyze projects.
  • Loading branch information
heejaechang authored Nov 15, 2018
1 parent 8740f8b commit d5f7119
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,42 @@ public async Task Project_AnalyzerOptions_Change()
}
}

[Fact]
public async Task Project_OutputFilePath_Change()
{
using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler))
{
var solutionInfo = GetInitialSolutionInfo_2Projects_10Documents(workspace);
workspace.OnSolutionAdded(solutionInfo);
await WaitWaiterAsync(workspace.ExportProvider);

var projectId = workspace.CurrentSolution.Projects.First(p => p.Name == "P1").Id;
var newSolution = workspace.CurrentSolution.WithProjectOutputFilePath(projectId, "/newPath");
var worker = await ExecuteOperation(workspace, w => w.ChangeProject(projectId, newSolution));

Assert.Equal(5, worker.SyntaxDocumentIds.Count);
Assert.Equal(5, worker.DocumentIds.Count);
}
}

[Fact]
public async Task Project_OutputRefFilePath_Change()
{
using (var workspace = new WorkCoordinatorWorkspace(SolutionCrawler))
{
var solutionInfo = GetInitialSolutionInfo_2Projects_10Documents(workspace);
workspace.OnSolutionAdded(solutionInfo);
await WaitWaiterAsync(workspace.ExportProvider);

var projectId = workspace.CurrentSolution.Projects.First(p => p.Name == "P1").Id;
var newSolution = workspace.CurrentSolution.WithProjectOutputRefFilePath(projectId, "/newPath");
var worker = await ExecuteOperation(workspace, w => w.ChangeProject(projectId, newSolution));

Assert.Equal(5, worker.SyntaxDocumentIds.Count);
Assert.Equal(5, worker.DocumentIds.Count);
}
}

[Fact]
public async Task Test_NeedsReanalysisOnOptionChanged()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ private async Task EnqueueProjectConfigurationChangeWorkItemAsync(ProjectChanges
!object.Equals(oldProject.AssemblyName, newProject.AssemblyName) ||
!object.Equals(oldProject.Name, newProject.Name) ||
!object.Equals(oldProject.AnalyzerOptions, newProject.AnalyzerOptions) ||
!object.Equals(oldProject.DefaultNamespace, newProject.DefaultNamespace))
!object.Equals(oldProject.DefaultNamespace, newProject.DefaultNamespace) ||
!object.Equals(oldProject.OutputFilePath, newProject.OutputFilePath) ||
!object.Equals(oldProject.OutputRefFilePath, newProject.OutputRefFilePath))
{
projectConfigurationChange = projectConfigurationChange.With(InvocationReasons.ProjectConfigurationChanged);
}
Expand Down

0 comments on commit d5f7119

Please sign in to comment.