Is it really 6 years since I last wrote about NDepend? Apparently so!

A lot has changed between v6 and the just-released v2022.1. Seriously, there are the changes listed at https://www.ndepend.com/whatsnew (it’s a long list), but I suspect there’s also even more than that.

NDepend remains the preeminent tool for .NET dependency analysis.

I thought I’d put the v2022.1 release through its paces by seeing what it makes of the .NET Interactive project from GitHub.

I loaded up NDepend and configured it to analyse just the Microsoft.DotNet.Interactive* assemblies. By default, a HTML summary report is generated:

NDepend HTML Report

I find the real insights come with using the Visual NDepend application to drill into different parts of the analysis. Here’s the ‘Dashboard’ view for the project.

Visual NDepend Dashboard

I tend to look at the Rules summary first. You can click on the number to the right of the rule status (e.g. the ‘8’ next to ‘Critical’), and this will then show the details of the 8 critical rule violations. You can now double-click on a rule to see where in the code this rule has been matched.

Once I’ve had a look at all the critical rule matches, then I’ll continue on to looking at the remaining rule violations.

It’s important to remember, NDepend is just a tool. It’s up to you to decide if a particular rule makes sense for your codebase. You might decide that a rule should be disabled, or you can even customise a rule to change the behaviour so it is more appropriate for your use case.

The new ILSpy integration could be useful for some. Unfortunately, it’s not a tool I use (I have the dotUltimate tools from JetBrains, so I tend to use dotPeek for decompiling).

Another nice enhancement is that analysis is now done out-of-process by default - whether you’re using Visual NDepend, or Visual Studio. This is a good thing, especially for Visual Studio. The more things that run in separate processes, the less chance something adversely affects Visual Studio.

A testament to the improved performance of NDepend is that it was quite tricky to take this screenshot showing the separate analysis process, as it had completed very quickly!

NDepend processes in Task Manager

There are also some nice improvements to .NET 6 support, with better handling of top-level statements and record types.

Finally, the ability to export query results to HTML, XML or JSON (in addition to other formats) either through the UI, or through NDepend’s API could be really useful if you want to process the query results outside of NDepend. Maybe generate some custom reports that could be part of your continuous integration build pipeline.

In closing, if you’re wanting to analyse your .NET code and learn more about how it is structured, check out NDepend. I’ll try not to leave it so long until my next post on NDepend!

Disclosure: I received a complementary license for NDepend as a Microsoft MVP award recipient