Skip to content

[Bug]: C#: var x = Get<T>(...) leaves x untyped, so x.Method() has no calls edge #4266

Closed

Description

@dvdrelin

What happened

var report = ServiceFactory.Get<IReport>(scope) leaves report untyped, so report.Build(...) has no calls edge. The same call is linked when the local is written IReport report = ....

Checked the Troubleshooting section. This is a code-only AST extract (graphify extract . --code-only --no-cluster), not an install, PATH, LLM, partial-extract, or ghost-duplicate problem. The same gap is still in the v0.9.82 source: a var is typed only from new T().

This is separate from #2624 / #2676. Those are about the call Get<T>(...) itself. After that call is linked, the variable on the left is still untyped.

Suggested rule

When the called method resolves to one declaration, type the var as that method's return type with the call-site type arguments substituted. T Get<T>() called as Get<IReport>() types the variable as IReport. List<T> CreateList<T>() called as CreateList<Item>() types it as List<Item>. Leave the variable untyped when the declaration is missing, an overload cannot be chosen, or an inferred type argument cannot be recovered.

Steps to reproduce

public interface IReport
{
    string Build(string name);
}

public static class ServiceFactory
{
    public static T Get<T>(object scope) where T : new() => new T();
}

public class Report : IReport
{
    public string Build(string name) => name;
}

public class Consumer
{
    public string Run(object scope)
    {
        var report = ServiceFactory.Get<IReport>(scope);
        return report.Build("daily");
    }
}



graphify extract . --code-only --no-cluster



### Expected


calls  Consumer.Run()  ->  IReport.Build()

Error output or graph output

### Actual

`Consumer.Run()` has no `calls` edge to `Build`. The same call is linked when the local is written as `IReport report = ...`.

Graphify version

0.9.75

Operating System

Windows

Python Version

3.13

Installation Method

pip

Additional Environment Details

pip install --user

Additional context

The only var recovery is the object_creation_expression branch in _csharp_method_receiver_types (graphify/extractors/engine.py). A generic invocation initializer is bound with no type. Confirmed on the installed 0.9.75 package and in the v0.9.82 tag.

Activity

  1. added
    bug
    on Oct 9, 2026
  2. github-actions commented on Oct 9, 2026

    @github-actions

    Thanks for opening this issue, @dvdrelin. 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.

  3. safishamsi commented on Oct 12, 2026

    @safishamsi
    Member

    Fixed in v0.9.87 (graphifyy 0.9.87 on PyPI) via #4268.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions