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
[Bug]: C#: an #if block can close the class early, so later members lose their class and their calls #5002
I have checked the Troubleshooting section in the README
What happened?
In C#, an #if block can make tree-sitter close the enclosing class too early. Every member after that point loses its class. It becomes a node with no Type. owner, no method edge from the class and no field typing, so its member calls are lost.
This is a different bug from #2631, where members inside the #if were missing (that one looks fixed on v8). Here the members after the block are hit, even when the #if body is trivial.
On Newtonsoft.Json, Dapper and AutoMapper I compared graphify's calls edges with what Roslyn resolves. On v8, 40 files in these three libraries parse with tree-sitter errors. Fixing just this takes total recall from 70.8% to 75.4% (Newtonsoft.Json alone: 72.8% to 79.0%).
Fixed in 0.9.103 (published to PyPI) via #5003. C# preprocessor directives and #if branches are blanked before parsing, so they no longer close a class early and drop later members.
Activity
github-actions commentedon Nov 4, 2026
Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
safishamsi commentedon Nov 5, 2026
Fixed in 0.9.103 (published to PyPI) via #5003. C# preprocessor directives and #if branches are blanked before parsing, so they no longer close a class early and drop later members.