Repository navigation
Description
Summary
VB.NET files are parsed (nodes show up as vbnet), but member access through the class name (AppSession.SessionId) does not produce a reference edge for Shared fields and Shared properties. codegraph callers returns 0 for them, and also for the class itself. Shared methods are resolved correctly.
In a real project this hides hundreds of usages that plain text search finds immediately, and makes impact / blast-radius output misleading.
Environment
| CodeGraph | 1.6.1 (Windows, official installer) |
| Node | v26.10.0 |
| OS | Windows 11 Enterprise 10.0.26100 |
| Language | VB.NET (.NET Framework WinForms) |
| Setup | codegraph init, no codegraph.json extension mappings |
Minimal reproduction (synthetic code)
AppSession.vb
Public Class AppSession
Public Shared SessionId As Guid = Guid.NewGuid()
Public Shared Property CurrentUser As String
Public Shared Function GetGreeting() As String
Return "Hello " & CurrentUser
End Function
End ClassConsumer.vb
Public Class Consumer
Public Sub Run()
Dim id As Guid = AppSession.SessionId
AppSession.CurrentUser = "demo"
Console.WriteLine(AppSession.GetGreeting())
End Sub
End ClassConsumer2.vb
Public Class Consumer2
Public Function Describe() As String
Return AppSession.CurrentUser & AppSession.SessionId.ToString()
End Function
End ClassSteps:
- Put the three files in an empty folder.
- Run
codegraph init(result: 11 nodes, 9 edges). - Run the
callerscommands below.
| Command | Result | |
|---|---|---|
codegraph callers GetGreeting |
1 caller: Consumer.Run (Consumer.vb:2) |
✅ |
codegraph callers SessionId |
0 callers | ❌ |
codegraph callers CurrentUser |
0 callers | ❌ |
codegraph callers AppSession |
0 callers | ❌ |
Expected
SessionIdandCurrentUserlistConsumer.RunandConsumer2.Describeas referencing symbols.AppSessionlists the classes that reference it.
Actual
Only the method call produces an edge. Field and property reads/writes through the class name produce none, so callers, impact and the blast-radius section of codegraph_explore under-report dependencies.
Impact on a real codebase
In a ~2,000-file VB.NET WinForms solution, a central static session class (Public Class with Public Shared members) is referenced from ~460 files according to grep.
codegraph callers <ClassName>returns only 6 results (all from one C# file).codegraph callers <SharedField>returns 0.codegraph callers <SharedMethod>works: 1,519 callers found.
So the problem looks specific to field/property access through the class name, not to the class being static.
Notes
- Not tested: instance-qualified access,
Imports-based access,Modulemembers. - Happy to test a fix against our real codebase and report numbers.
Activity
docs: add remediation plan; Phase 0 — release highlights and issue re…
Phase 4: resolution and extraction accuracy
fix(vbnet): link Shared fields and properties read through their class (
colbymchenry commentedon Oct 5, 2026
Thanks @serkanince for the report and the clear minimal repro.
The fix is on
mainin #2355, building on the approach in #2321 by @ChrisPrapas. VB.NET used to record only calls, so a read or write through a class name, likeAppSession.SessionIdorAppSession.CurrentUser = "demo", produced no reference at all. It now links both the member and the class. On your three files,codegraph callers SessionId,callers CurrentUserandcallers AppSessionall listConsumer.RunandConsumer2.Describe. Before, they returned 0.The same now applies to:
Enumvalues likeMode.FastSharedfields likeAppSession.Items(0)Sharedfunctions named without parentheses, which count as calls. UnderAddressOforNameOfthey stay plain references.The name is resolved the way VB.NET scopes it, through namespaces and
Imports, including aliases. A local, parameter or field that only shares the class's name, which VB.NET's case-insensitivity makes easy to hit, is not mistaken for the class. On two public WinForms projects, SCrawler and staxrip, this added about 2,500 and 5,900 correct links, and none were removed.Not covered yet: reads through
Me.or an instance variable (s.CurrentUser), andWithblocks.This ships in the next release. Re-index after upgrading (
codegraph index) to pick it up. You and @ChrisPrapas are both credited in the changelog. If you get a chance to run it on your ~2,000-file solution, the before and after numbers would be welcome.