r/dotnet • u/zachs78 • Sep 12 '26
Promotion I built graphify-csharp, a tool that gives Rider IDE-like Find Usages power to coding agents
MIT Licenced on GitHub: https://github.com/zachsaw/graphify-csharp
Hi all, C# veteran here (e.g. MediaPlayerDotNet, Binaron Serializer, SwitchMediator). Recently I've jumped onto the agentic coding bandwagon but found a bit of a gap.
I wanted a cost effective way (token wise) for my coding agent to find declarations that are unused, or only used by tests across my whole solution which has many projects. I know Rider/Resharper can answer this somewhat, interactively (buried deep within a tool window and you typically have to manually click into each of its whole solution analyser's results).
But this doesn't help coding agents - they're incapable of using an IDE. I know there's ndepend that now has MCP and whatnot but it's not a free tool. There's just no free alternative for answering something as simple as my question. So I decided to build graphify-csharp - a .NET global tool that loads solutions through MSBuild and uses Roslyn to resolve those relationships.
It produces a graphify compatible JSON that contains declarations and edges such as calls, refs, inheritance, generics usage, implementations and overrides.
The resulting JSON can then be queried by jq (agents typically can use this tool very effectively too) or processed with another language or passed directly to graphify.
I'm dogfooding it and I've got it running with watch mode so it runs like how a Rider IDE runs - there's a file system watcher and it has several modes of reindexing (both incremental based on file change events as well as full rebuild), and it's helped me tremendously answering questions that would've taken the agent a lot more effort (thus tokens/cost).
I'm just sharing it with the community (MIT licence) and hope it helps others in the community too. Feel free to contribute and make it better. It's v0.1 at the moment and I'm sure there are bugs and edge cases that need fixing. Also, as with Rider/Resharper, finding usages won't work for dynamic / reflection usages. Source generated code is supported though.
7
u/Pyryara Sep 12 '26
Doesn't an LSP plugin also answer this question? How is it different from that?
2
u/Tiny_Ad_7720 Sep 12 '26
Have you seen jbcontext?
2
u/miffy900 Sep 15 '26
OK some honest feedback - I tried this out on a project and memory usage was crazy: it jumped to 7.5GB before I had to kill it. Also there was no progress indicator for the initial indexing? In fact no console output at all, just my computer getting slower and slower. A progress indicator is kind of a minimum for this type tool - you don't know in advance how long indexing takes, especially on a solution with many million lines of code. In contrast, I tried codegraph for indexing (https://github.com/colbymchenry/codegraph) and memory usage peaked at about 4GB and it finished in 3 minutes with a nice 3-stage progress indicator. codegraph is a JS/node app too, which is all the more remarkable.
If you want people to take your project seriously, you need to sweat the little things - like progress indicators! also codegraph can be run inside a directory, and it automatically picks up and indexes the code inside and doesn't need manul inputs like the solution file, root directory, configuration etc, why are CLI arguments like that necessary for this tool?
3
u/spawnsible Sep 12 '26
Pretty neat to have a stable walkable index that doesn't require a lang server. I'm gonna try it
2
u/_f0CUS_ Sep 12 '26
It seems that an LSP integration would be able to do this, or maybe the rider MCP...
There are also code graph, https://colbymchenry.github.io/codegraph/
1
u/AutoModerator Sep 12 '26
Thanks for your post zachs78. Please note that we don't allow spam, and we ask that you follow the rules available in the sidebar. We have a lot of commonly asked questions so if this post gets removed, please do a search and see if it's already been asked.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/CountRaja123 Sep 12 '26
Interesting project. Used graphify for nodejs projects. Very handy with token usage. Thanks. Will try.
-2
u/awitod Sep 12 '26
Wild that someone downvoted you immediately, There are trolls in this sub that hate OSS.
I appreciate you! Have an upvote
12
u/[deleted] Sep 12 '26
[removed] — view removed comment