Skip to content

Node ID collisions when multiple files share the same stem (e.g. Program.cs) #438

Description

@V0v1kkk

Problem

_make_id(stem, name) uses only the file stem to generate node IDs. When a project has multiple files with the same name in different directories (e.g. src/App1/Program.cs and src/App2/Program.cs), their nodes collide — methods from both files merge into a single node, producing an incorrect graph.

This is common in .NET solutions where each project has its own Program.cs, Startup.cs, AssemblyInfo.cs, etc.

Proposed Fix

Add a post-extraction pass that detects colliding node IDs (multiple nodes from different source_file paths sharing the same ID) and disambiguates them by prepending the parent directory name.

For example:

  • program_programapp1_program_program and app2_program_program

Impact

Tested on a .NET solution with 2 Program.cs files — nodes are now correctly separated.

I have a PR ready.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions