Questions tagged [ndepend]
NDepend is a static analysis tool for .NET managed code that focuses on code dependencies and quality.
284
questions
0
votes
1
answer
34
views
How do I turn off the sound signal?
When an error occurs,NDepend beeps.
When the project has errors.
How do I turn off the sound signal?
Update-1
I use:
Visual NDepend.
The event at which the sound signal appeared:
I performed the ...
1
vote
1
answer
16
views
Why does the Azure Devops extension show all code as Not My Code?
When running the NDepend Azure Devops extension for my main build solution, the lines of code show no lines of code for my code and show everything as NotMyCode and I can not determine why. The ...
2
votes
1
answer
16
views
NDepend: how to limit JustMyCode to the methods used by x?
The official documentation explains how to limit JustMyCode by exclusion using notmycode
notmycode from m in Methods where
m.SourceFileDeclAvailable &&
m.SourceDecls.First().SourceFile....
1
vote
0
answers
60
views
NDepend - Folder name hints
I use NDepend.Console.exe (NDepend version 2022.1.4) to create .ndproj from command line - /cp flag.
The build script changes my build path to FinalDLLs\bin\x64(or 86)/Release instead of \bin\x64(or ...
1
vote
1
answer
20
views
NDepend - Baseline Coverage by Assembly Query
is it possible to have a comparison by assembly to the baseline build?
At the moment I have a report that shows the coverage by assembly, but I would like to add the coverage compared to the baseline ...
1
vote
1
answer
44
views
Is it possible to rearrange nodes in the NDepend dependency graph?
If a graph is simple, it's easy enough to just look through. For more complex graphs though, it's hard to make sense of if it's not arranged in a way that resembles how developers conceptualize a ...
1
vote
1
answer
31
views
How to identify coupling between types due to typeof composition using NDepend API's?
How can I identify the dependencies between the two types only due to typeof composition using NDepend rules/API.
In the below example the type is dependent on UsedDependendType only through typeof(...
1
vote
1
answer
106
views
How can I produce an xml sequence diagram?
I'd like to have something similar to the following screen from Callgraph viewer for Eclipse
1
vote
1
answer
82
views
NDepend says PDB file missing, incorrectly locates release exe instead of debug exe
NDepend newbie here. I am using the standalone version (VisualNDepend.exe) to analyze a C# solution.
When I choose the solution file, NDepend warns that the assembly PDB file is missing:
The ...
1
vote
1
answer
31
views
How to compute the metric Response for a Method with NDepend
Is there any way to get the number of "source code lines" that could result from calling nested function?
For this question my example:
Selection of functions
Function name
Lines of Code (...
1
vote
1
answer
46
views
NDepend: how to export the result from a query
I've got a CQLinq query which returns a list of methods and a list of members for each of them. Exporting the query result will only show the number of elements. I thought about using a Linq Aggregate(...
2
votes
1
answer
49
views
How to group in CQLinq?
I have an autogenerated interface and implementation which define 3000+ methods and for each one the respective asynchronous signature. All in all 6,000+ methods.
I would like to figure out which ones ...
1
vote
1
answer
45
views
NDepend find private methods without documentation
i'm new to ndepend and i want a cqlinq rule to find all not documented methods. Thats my current query, but there is no documented-Property.
from m in Application.Methods
.Where(m => !m....
1
vote
1
answer
65
views
Ndepend Class Coupling Value exclude all classes not in my project
I tried to calculate the class coupling with ndepend. But as far as I can see, all dependencies on other classes are added (see image, so the ones from my Project: MultiCar, from mscorlib and System). ...
1
vote
1
answer
22
views
NDepend: Find fields that are either a given type or use a given type in their generic parameters
How would I go about using NDepend to not only identify JustMyCode.Fields that are exactly a given type, but also indirectly, i.e. fields like IList<MyType>, IDictionary<int, MyType>, Lazy&...
2
votes
1
answer
28
views
Find code using [Obsolete] marked code of a list of assemblies using NDepend
I am currently trying to use NDepend to identify (our) code that uses [Obsolete] marked members of a particular group of referenced assemblies (in my example starting with "Microsoft....
1
vote
2
answers
69
views
Use source control history with nDepend to create trend
We would like to pick points in time in our source control (git) to generate trend metrics.
We are working through a trial of nDepend to determine its value for our large, 15+ -year-old code base.
The ...
1
vote
1
answer
29
views
Count the number of indirectly used assemblies in NDepend
I'm trying to count the indirect assembly references. The following does not work because IsIndirectlyUsing wants a constant string: "Only constant literal string are accepted as input for ...
1
vote
0
answers
26
views
NDepend code rule needed for detecting Async constructions inside sync method lacking exception handling
An interesting rule would be to detect async's without exception handling. Consider the following example where you need to run some async code inside a sync method:
public void SomeSyncMethod()
{
...
0
votes
0
answers
39
views
Configure Binaries directory programatically when using NDepend API
When our projects are built using visual studio, the assemblies are configured to be written to output directory like "RootFolder\bin{type}{platform}". Type --> Release/ Debug and Platform --> x86/x64....
2
votes
2
answers
72
views
Can NDepend detect where string interpolation is used in C#?
I'd like to enforce a rule that log statements do not use string interpolation:
Example
Log($"Added {count} messages.");
Instead I want to encourage/force developers to use structured logging, which ...
0
votes
1
answer
65
views
No assembly found to analyze. NDepend will only analyze assemblies with PDB files generated
NDepend version :NDepend Azure DevOps/ TFS extension.
I try to add some setting to analyse every .NET solution to show report on TFS website.
The build process shows some message.It looks like my ...
1
vote
0
answers
516
views
How to avoid namespaces dependency cycles between my entities?
I analysed my code with NDepend and it detected some critical rules one of them is: "Avoid namespaces mutually dependent".
But I can't figure how I can organize my code to get rid of this "errors", ...
0
votes
1
answer
118
views
Exclude test projects from Ndepend Analysis
I have a visual studio solution which has a lot of projects including unit test projects. I am using NDepend API to analyze the solution. The intention is to get the relationship between methods. I am ...
1
vote
1
answer
101
views
Ndepend API get rules from Ndrules file
I am using Ndepend API in my .NET 4.7 project, currently i am writing the rules in my code like this example :
var types = assemblies.ChildTypes()
.Where(x => !x.IsThirdParty && x....
1
vote
0
answers
24
views
Get value of a field with Ndepend
I'm trying to make a rule for detect fields that hava assigned values with Ndepend. But I don't know if it's possible to get the value of the fields.
For example, if I have String X='abc' I want to ...
1
vote
0
answers
10
views
Create custom extensions for NDepend
By looking at the NDepend documentation, I found that you can create procedure in your CQLinq queries (as stated here). I was looking for a way to create custom extensions or procedures that I would ...
1
vote
1
answer
41
views
NDepend Report JustMyCode
I would like to get the Abstractness and Instability of a Solution and ignore third party libraries. I know, I can use JustMyCode in CQLinq, but I want to use the diagram produced by the report. How ...
1
vote
1
answer
69
views
How can I persist the analysis result for an NDepend project?
I am trying out NDepend (2018.2.0) but I am stuck early with this one and I am receiving an error for reasons that don't appear to be true.
After install NDepend and starting VS 2015:
Add Assemblies ...
1
vote
0
answers
28
views
Finding all methods that hasn't log inside try catch with NDepend
I'm refactoring an existing application and I have got a per class instance in the form
private readonly ILog log; //(Log4net, but the namespace isn't
I've got some method in the form
public ...
1
vote
1
answer
50
views
NDepend query to detemine what methods in other DLLs are being called
We have a very large code base with multiple teams owning different layers. One team would like to know what methods and types are being called so they can centralize them. So for a set of DLL's and ...
1
vote
0
answers
52
views
Find code where a method is being called in a loop with NDepend
We have a large codebase with a lot of legacy code, sometimes not written in the most efficent form. I'd like to identify places where we can replace multiple Get method calls with a single MultiGet ...
1
vote
1
answer
22
views
How to obtain refereced method (destination) namespace
I am using NDepend 2018.1.1. and I need to obtain the namespace of the target of the following NDepend Query
//
// <Name>Relevant Methods</Name>
//
let e9 = "Sys.Core.App.CommonService"
...
1
vote
1
answer
127
views
Sort classes in dependency order (NDepend)
I'm new to NDepend and just getting my feet wet. I'm able to create a class dependency graph using the following simple query:
from t in Application.Types
// remove compiler generated classes
where !...
1
vote
1
answer
215
views
C# How to get the Circular Methods in a Project/Solution using ndepend in the latest version 2018.1.1
I tried this code in NDepend version 2018.1.1 with some changes made to the original code which was posted on stackoverflow. It is to get the Methods which have a circular dependencies (i.e. calling ...
1
vote
1
answer
492
views
How to fix: Avoid non-readonly static fields
I am using NDepend and in the following code, it detects this code smell.
But if I add readonly, then it wont compile.
namespace todo
{
using System;
using System.Collections.Generic;
...
0
votes
0
answers
125
views
How to ignore all external assemblies in NDepend
Having started to use NDepend I'm frustrated by being cluttered with issues related to nuget packages and external dlls.
For example I'm looking at 400 issues of >>Interface name should begin with a '...
2
votes
1
answer
183
views
Don't assign a field from many methods
I have a class that has a field that is being assigned a value from multiple methods.
public class Shape
{
private Point2D m_location;
public void Move()
{
m_location = ...
}
...
1
vote
0
answers
37
views
NDepend can't find attribute from mscorlib in rule
I'm trying to exclude interop structs (structs having explicit struct layout) from getting "dead field" warnings from NDepend. My query with the added attribute filter looks like this:
warnif count &...
1
vote
2
answers
240
views
Using OpenCover coverage data with NDepend?
My project uses OpenCover to analyse unit test coverage.
We've recently started using NDepend to improve the project. We're getting a lot out of it, but are stumped by one feature...
NDepend has ...
1
vote
1
answer
131
views
How to ignore NDepend issue?
What is the recommended approach to ignore a NDepend issue or rule violation? Modify the query in the NDepend config file, or is there a better approach?
Just wondering that starting to add ORs in ...
1
vote
1
answer
30
views
NDepend: searching classes which use a certain class as a Property or a Field (directly or inside a list)
I want to get a list of the classes which use a certain class (let call it X) as a Property or a Field (directly or inside a list)
i.e.
public class A
{
X field;
List<X> field2;
}
1
vote
0
answers
40
views
Use NDepend to check if a method calls the base.Method at the end
I've to check if the base.InitializeAsync is called as the latest line of code at the method's end.
Consider the following code
protected override async Task InitializeAsync()
{
...
1
vote
1
answer
42
views
NDepend Linq mixing the output of one query with another
I'd like to restrict the queries from NDepend to a specific set of types. But I get the following error if I try to use a normal assignment:
Only single statement queries are supported. If you
...
1
vote
0
answers
38
views
NDepend to find if control is checked inside the Constructor
On a WPF project I'm developing with Catel framework, I'm using IoC pattern to inject services and repositories. I wish to use NDpend to find if all the injected interfaces have the following check ...
1
vote
1
answer
202
views
How can I use NDepend to find the members that cause two types to be intertwined?
I'm trying to disentangle a lot of heavily interdependent types in one of my company's .NET assemblies.
It seems like the first step would be to take a couple of classes and look at which members of ...
1
vote
1
answer
97
views
Find used types and members from a specific assembly
I am trying to create a CQLinq query which will give me all types and/or members from a specific assembly that is being used by the rest of the solution.
I need this information so I can move/...
1
vote
2
answers
670
views
Avoid non-readonly static fields Rule
I'm reviewing with NDepend some code I wrote few time ago and I ended up on this warning
The warning is referred on the following snippt
private static char csvSeparator;
public static char ...
2
votes
0
answers
57
views
Number of occurrences of a method NDepend
I need to write an NDepend rule that checks if every await of an Async Method uses ConfigureAwait(false).
I check if a method uses ConfigureAwait(Boolean). If that method doesn't use it, it has ...
2
votes
1
answer
100
views
Add old analysis to NDepend and specify date
I've inherited a legacy project and have been working on improving the code this last year. To see my evolution, I've bought an NDepend license and started using it with success.
But I would like to ...