Skip to content

SyntaxNode actions related to unions trigger multiple times #84570

Closed

Description

@bjornhellander

Version Used:

5.6.0

Steps to Reproduce:

It seems that all registered SyntaxNode actions related to unions are triggered multiple times. For the union declaration itself, an action is called 2 times and any actions triggering inside a union (like a field declaration) is called 3 times.

I am aware that this is only preview functionality and that you have already changed the representation of union declarations since 5.6.0, but reporting it anyway in case you are not already sure this isn't happening with the new representation as well.

Expected Behavior:

Registered actions should only be called once for the same node.

Actual Behavior:

Actions can be called multiple times.

Activity

  1. added theissue type on Jul 22, 2026
  2. added this to the 18.10 milestone on Jul 22, 2026
  3. jjonescz commented on Jul 22, 2026

    @jjonescz
    Member

    SyntaxNode actions

    By this I assume you mean AnalysisContext.RegisterSyntaxNodeAction?

  4. AlekseyTs commented on Jul 22, 2026

    @AlekseyTs
    Contributor

    @bjornhellander Could you provide complete repro code that demonstrates the behavior?

  5. added
    Need More Info
    on Jul 22, 2026
  6. bjornhellander commented on Jul 22, 2026

    @bjornhellander
    Author

    Yes, I mean actions registered via RegisterSyntaxNodeAction.

    I don't have a simple repro for you, but you can see an example of actions being called three times for nodes inside a union declaration here and in many other places in the same repo (with similar comments).
    This is an example of a test which reports 2 diagnostics instead of one if the normal register method is used here

  7. added
    untriaged
    and removed
    Need More Info
    on Jul 22, 2026
  8. added a commit that references this issue on Jul 27, 2026
    a213b74
  9. bjornhellander commented on Jul 27, 2026

    @bjornhellander
    Author

    Awesome!

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

Metadata

Metadata

Assignees

Labels

Area-CompilersFeature - Unionsuntriaged

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions