Skip to content

Report when the same analyzer is passed multiple times #62610

@RikkiGibson

Description

@RikkiGibson

In dotnet/wpf#6792 (comment) we found a scenario where the build was passing in the exact same analyzer multiple times.

When the same source file is passed multiple times, we give a warning and drop the duplicated file:

// warning CS2002: Source file '{0}' specified multiple times
diagnostics.Add(new DiagnosticInfo(MessageProvider, (int)ErrorCode.WRN_FileAlreadyIncluded,
Arguments.PrintFullPaths ? normalizedFilePath : _diagnosticFormatter.RelativizeNormalizedPath(normalizedFilePath)));
trees[i] = null;

Perhaps we should do something similar for analyzers.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions