Skip to content

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

Description

@JoeRobich

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);
});
}
}

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions