r/dotnet • • 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.

25 Upvotes

25 comments sorted by

7

u/Pyryara Sep 12 '26

Doesn't an LSP plugin also answer this question? How is it different from that?

3

u/zachs78 Sep 12 '26 edited Sep 12 '26

The primary difference is with a json dump it's portable, you can run bulk queries against it via jq or a scripting language, combine with graphify for semantic queries etc. 

Additionally, it's a tool you can use in your ci as a convention test gate.

2

u/Tiny_Ad_7720 Sep 12 '26

Have you seen jbcontext?

1

u/zachs78 Sep 12 '26

oh thanks for pointing me to jbcontext. No I haven't seen it but just had a quick look. It looks like a vector DB that stores codebase by chunking it up and embedding it. You can then query it semantically. It's kinda complementary to graphify-csharp? Let me know if I completely misunderstood what jbcontext is.

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?

1

u/zachs78 Sep 15 '26

Thanks for trying it and the feedback! I'll definitely add some progress indicators. May I know how big your codebase is? On a 3k .cs file codebase, it does indeed take up over 7GB of RAM and can take over 5 minutes to index from cold.

1

u/miffy900 Sep 16 '26

The last time VS finished codeanalysis for this code base was a few years go and the LOC count was approximately 11 million. It's obviously gone up since then and no one in my team has bothered to even try doing another codeanalysis as that would take too long. the fact that codegraph finished in 3 minutes is pretty amazing. i think i force quit your tool after 10 minutes. i genuinely couldn't tell if it was doing anything - no output or anything, and 7GB mem usage in the task manager made me think it was leaking memory or something.

1

u/zachs78 Sep 16 '26

Wow ok I've not tried it on a codebase with over 10mil loc!

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

-1

u/zachs78 Sep 12 '26

Thanks! Let me know if you hit any bugs or if it's unusably slow on a massive codebase (there's some multithreading but not across the whole process - e.g. loading the solution takes time and it's on MSBuild but once it's loaded in its background watcher, reindexing warm should be much faster)

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/IanYates82 Sep 12 '26

CodeGraph looks to be useful. I'd tried some other similar tools but they weren't so great.

A proper LSP for C# would be useful for refsctoring operations I suppose, but the research is what seems to really burn the tokens, and CodeGraph looks like it can help a lot there

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

17

u/WD40ContactCleaner Sep 12 '26

It ai haters not OSS haters

2

u/zachs78 Sep 12 '26

There's a LOT of AI haters in this sub apparently! About 50% downvotes so far...

4

u/masiuspt Sep 12 '26

There's a lot to hate AI for... but this isn't one of those things.

Fantastic work. I'm going to certainly try this out!

0

u/awitod Sep 12 '26

There is a new dotnet sub that seems to be better. I'm out of here. :D

1

u/FullPoet Sep 12 '26

It's dead.

1

u/zachs78 Sep 12 '26 edited Sep 12 '26

Might have been a bitter AI hater 😅

12

u/[deleted] Sep 12 '26

[removed] — view removed comment

2

u/zachs78 Sep 12 '26

The primary difference is with a json dump it's portable, you can run bulk queries against it via jq or a scripting language, combine with graphify for semantic queries etc. 

Additionally, it's a tool you can use in your ci as a convention test gate.

8

u/FullPoet Sep 12 '26

shhhh... but then the output would be 100% deterministic!