Skip to content

Investigate using RegisterSyntaxNodeActionWithDuplicateNodeGuard to avoid duplicate diagnostics #170

Open

Description

@bjornhellander

Some Roslyn versions call syntax node actions more than once for the same node, which gives duplicate diagnostics (dotnet/roslyn#53136, dotnet/roslyn#58561 and dotnet/roslyn#70488). This affects users on those Roslyn versions, and the tests work around it in many places: the GetExpectedResult...() overrides in the test projects, and code fix providers that remove duplicate text changes (IndentationCodeFixProvider, SA1629CodeFixProvider).

AnalyzerExtensions already has RegisterSyntaxNodeActionWithDuplicateNodeGuard, but it is unused and marked [Obsolete]. Investigate whether to use it for the affected registrations, so the duplicates go away and the workarounds can be removed.

Things to look at:

  • Which registrations are affected, and whether the guard catches all the duplicates.
  • An overload for multiple syntax kinds, and what to do about the [Obsolete] attribute.
  • The memory cost of tracking processed nodes.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions