Problem
When a C# class uses the C# 12 primary constructor syntax (public class Foo(Bar bar)), the class and all its methods may be completely absent from the CodeGraph index. This breaks search, node lookup, call chain analysis, and context queries for those symbols.
Reproduction
Tested with CodeGraph on a .NET 10 project (298 C# files, 3073 nodes indexed). The classTypes: ['class_declaration'] in csharp.ts should match primary-constructor classes, but results are inconsistent:
| Class |
Syntax |
Indexed? |
DataService |
public class DataService(IMemoryCache cache, ...) |
✅ Yes |
InstanceService |
public class InstanceService(InstanceManager m, ProfileManager p, ...) |
❌ No |
UpdateService |
public partial class UpdateService(...) : ILifetimeService |
❌ No (only nested IOptions found) |
InstanceService has 2 public methods (DeployAndLaunchAsync, Deploy) — neither appears as a node. The file itself is indexed (imports are extracted), but the class declaration and its methods are skipped entirely.
Downstream Impact
codegraph_search("InstanceService", kind="class") → empty
codegraph_node("InstanceService") → falls through to an import node instead of the class
codegraph_callees("PlayAsync") → misses the call to DeployAndLaunchAsync (because the target symbol doesn't exist)
codegraph_context("Instance launch workflow") → returns irrelevant URL-launcher helpers instead of the game launch logic
Hypothesis
The inconsistency suggests the issue may not be solely about primary constructors (since DataService is indexed). Possible factors:
partial modifier combined with primary constructor
- Inheritance clause (
: ILifetimeService) after the parameter list
- Parameter types from external projects / git submodules causing tree-sitter parse errors
- Number of parameters or line count in the parameter list
It would be worth testing tree-sitter-c_sharp's AST output for these patterns to see if class_declaration nodes are produced correctly.
Problem
When a C# class uses the C# 12 primary constructor syntax (
public class Foo(Bar bar)), the class and all its methods may be completely absent from the CodeGraph index. This breaks search, node lookup, call chain analysis, and context queries for those symbols.Reproduction
Tested with CodeGraph on a .NET 10 project (298 C# files, 3073 nodes indexed). The
classTypes: ['class_declaration']incsharp.tsshould match primary-constructor classes, but results are inconsistent:DataServicepublic class DataService(IMemoryCache cache, ...)InstanceServicepublic class InstanceService(InstanceManager m, ProfileManager p, ...)UpdateServicepublic partial class UpdateService(...) : ILifetimeServiceIOptionsfound)InstanceServicehas 2 public methods (DeployAndLaunchAsync,Deploy) — neither appears as a node. The file itself is indexed (imports are extracted), but the class declaration and its methods are skipped entirely.Downstream Impact
codegraph_search("InstanceService", kind="class")→ emptycodegraph_node("InstanceService")→ falls through to animportnode instead of the classcodegraph_callees("PlayAsync")→ misses the call toDeployAndLaunchAsync(because the target symbol doesn't exist)codegraph_context("Instance launch workflow")→ returns irrelevant URL-launcher helpers instead of the game launch logicHypothesis
The inconsistency suggests the issue may not be solely about primary constructors (since
DataServiceis indexed). Possible factors:partialmodifier combined with primary constructor: ILifetimeService) after the parameter listIt would be worth testing tree-sitter-c_sharp's AST output for these patterns to see if
class_declarationnodes are produced correctly.