Skip to content

C#: properties are not nodes, so nothing in the graph can point at a member #3006

Closed

Description

@durmazoguzhan

C# is the only language with a class-shaped type layer whose state is missing from the graph. A field or property produces a references edge to its type and never a node of its own, so nothing in the graph can point at a member.

public class Variant {
    public bool IsShowCategory { get; set; }
    public void Touch() { }
}

Nodes: Variant, .Touch(). Edges: Variant method .Touch(). IsShowCategory is absent.

What the other languages do

Checked by running them, not by reading the configs:

language member relation
C++ data member defines
C struct field defines (in flight, #2971)
Swift computed / observed property function-like member node (#2220)
Swift enum case case_of
Java enum constant case_of
JS/TS class field method when callable
C# field, property nothing

#2971's argument for C is the one that applies: the struct is C's primary data-modeling construct, so dropping it erased the type layer. Properties are C#'s.

Properties, not fields

ids.normalize_id casefolds and strips leading underscores, so _count and Count are the same id. Emitting both hands the node to whichever the parser reaches first, which is the private backing field, and the public member disappears behind it. In C# the property is the state's public identity, so it is the half worth having, and fields stay out until the id question has an answer.

Cost

On a 1457-file .NET service: 9925 -> 14683 nodes and 29547 -> 34182 edges, +48% and +16%. It is a DTO-heavy corpus, which is where the ratio comes from. The added nodes are leaves, so the hub structure does not move.

Patch in #3010.

Not this issue

A member node on its own does not answer "which code fills this member", because no language in the tree has a member-level usage edge. That is #3012, and it is a design question rather than a gap: it would be the first of its kind here.

Related

Activity

  1. durmazoguzhan commented on Aug 24, 2026

    @durmazoguzhan
    ContributorAuthor

    Putting the branch behind this where it can be read, since the issue claims a patch exists and there was no way to check that: durmazoguzhan/graphify@feat-csharp-member-nodes. Thirty three lines in the C# field and property branches, mirroring the C++ field emission.

    Deliberately not a PR. On its own it is +5564 nodes on a 9925-node graph and explain on a property name comes back with seven ambiguous leaves, so the cost lands before any of the value does. It goes up properly once there is an answer on the three questions above, in particular whether the node set should be narrowed to members something actually touches, and it wants tests either way.

  2. durmazoguzhan commented on Aug 24, 2026

    @durmazoguzhan
    ContributorAuthor

    Changing my position on half of this, and the reason is worth writing down.

    I opened this asking about both halves at once, which was wrong. They are not in the same position:

    The declaration half is not new ground. I went through what each language emits rather than reading the configs, and member nodes are settled: C++ emits a node per data member with defines, #2971 is adding the same for C structs on exactly this argument, #2220 gave Swift computed properties nodes, Swift enum cases and Java enum constants get case_of, JS/TS class fields get method when callable. C# is the outlier, not the pioneer. So that half is a PR, not a question: #3010, with the same relation and context="field" the C++ branch uses, and the cost stated (+56% nodes on a DTO-heavy corpus, leaves only, god nodes unmoved).

    The usage half is new ground, and now I can say that with evidence rather than impression. Every language stops at the container:

    Java   Status.ACTIVE   ->  .isOn() references Status    (the enum, not the constant)
    C++    w.width         ->  area()  references Widget    (the class, not the field)
    PHP    Foo::$prop      ->  uses_static_prop -> Foo      (the class)
    PHP    Foo::BAR        ->  references_constant -> Foo   (the class)
    SQL    a view's SELECT ->  reads_from -> table          (the table, not the column)
    

    Nothing anywhere points at a member. So the three questions in the issue narrow to the ones that are actually open: reads and writes as separate relations or one with a context, whether the member node set should be narrowed to members something touches (which would reverse the order and make #3010 the follow-up), and whether this is C#-only or the existing member layers in C++ and Swift grow usage edges too.

    Leaving this issue open for that. #3010 stands on its own either way.

  3. changed the title [-]C#: fields and properties are not nodes, so no edge can point at a member[/-] [+]C#: properties are not nodes, so nothing in the graph can point at a member[/+] on Aug 24, 2026
  4. durmazoguzhan commented on Aug 24, 2026

    @durmazoguzhan
    ContributorAuthor

    Rewrote the description above and split the issue, because bundling both halves here was the wrong call and made the PR reference awkward.

    The scope also narrowed while I was fixing the review finding on #3010: properties only, no fields, because ids.normalize_id folds _count and Count into one id and emitting both lets the private backing field take the public member's node.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions