Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not perform a design time build when .editorconfig files are modified #2112

Closed
JoeRobich opened this issue Mar 8, 2021 · 0 comments · Fixed by #2234
Closed

Do not perform a design time build when .editorconfig files are modified #2112

JoeRobich opened this issue Mar 8, 2021 · 0 comments · Fixed by #2234
Assignees

Comments

@JoeRobich
Copy link
Member

It would suffice to update the AnalyzerConfigDocuments in the CurrentSolution. The current implementation can cause build loops as SourceGenerators can generate .editorconfig files on disk from on MSBuild properties. See dotnet/aspnetcore#30750

if (_workspace.EditorConfigEnabled)
{
// Watch beneath the Project folder for changes to .editorconfig files.
_fileSystemWatcher.Watch(".editorconfig", (file, changeType) =>
{
QueueProjectUpdate(projectFileInfo.FilePath, allowAutoRestore: false, projectFileInfo.ProjectIdInfo, file);
});
// Watch in folders above the Project folder for changes to .editorconfig files.
var parentPath = Path.GetDirectoryName(projectFileInfo.FilePath);
while (parentPath != Path.GetPathRoot(parentPath))
{
if (!EditorConfigFinder.TryGetDirectoryPath(parentPath, out parentPath))
{
break;
}
_fileSystemWatcher.Watch(Path.Combine(parentPath, ".editorconfig"), (file, changeType) =>
{
QueueProjectUpdate(projectFileInfo.FilePath, allowAutoRestore: false, projectFileInfo.ProjectIdInfo, file);
});
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants