You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SyntaxNode actions related to unions trigger multiple times #84570
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.
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
Activity
jjonescz commentedon Jul 22, 2026
By this I assume you mean
AnalysisContext.RegisterSyntaxNodeAction?AlekseyTs commentedon Jul 22, 2026
@bjornhellander Could you provide complete repro code that demonstrates the behavior?
bjornhellander commentedon Jul 22, 2026
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
Fix duplicate `SyntaxNodeAction`s for union declarations and its memb…
bjornhellander commentedon Jul 27, 2026
Awesome!
Test C# 15 with a Roslyn 5.10 preview that fixes duplicate union call…