Category: projects

NetCoreUsefullEndpoints-part 13–adding runtime information

In the Nuget NetCoreUsefullEndpoints I have added information about the runtime information :

You can access by going to localhost:5027/api/usefull/runtimeinformationAll and the end result is

{
“frameworkDescription”: “.NET 8.0.8”,
“osDescription”: “Microsoft Windows 10.0.22631”,
“processArchitecture”: “X64”,
“osArchitecture”: “X64”
}

The code that returns this is

route.MapGet("api/usefull/runtimeinformation/", (HttpContext httpContext) =>
        {
            return TypedResults.Ok(new Helper().FromStaticRuntimeInformation());
        })

( I have used a Roslyn Code Generator , https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_Static#example–source-csproj-source-files- , that generates a class from a static class )

NetCoreUsefullEndpoints-part 12–adding url adresses

In the Nuget NetCoreUsefullEndpoints I have added information about the current process :

You can access by going to localhost:5027/api/usefull/adresses and the end result is

[
     “http://localhost:5027″
]

The code that returns this is

route.MapGet("api/usefull/adresses", (HttpContext httpContext, [FromServices] IServer server) =>
        {
            var adresses = server.Features.Get<IServerAddressesFeature>();
            var ret= adresses?.Addresses?.ToArray()??[] ;
            return TypedResults.Ok(ret);
        });

NetPackageAnalyzer–part 13–executable lines

The .NET Tool , https://www.nuget.org/packages/netpackageanalyzerconsole , can now analyze a solution and see the number of executable lines

The program is showing the number of executable lines per method , class , assembly .

diagram

https://learn.microsoft.com/en-us/visualstudio/code-quality/code-metrics-values?view=vs-2022

Install from https://nuget.org/packages/netpackageanalyzerconsole

NetPackageAnalyzer–part 12-CyclomaticComplexity

The .NET Tool , https://www.nuget.org/packages/netpackageanalyzerconsole , can now analyze a solution and see the cyclomatic complexity.

Cyclomatic Complexity for assembly, class, method

The cyclomatic complexity of a section of code is the number of linearly independent paths through the code. It is a quantitative measure of the number of linearly independent paths through a program’s source code.

The program is showing the cyclomatic complexity of the assembly, class, and method. You should start with the method – it is the easy to analyze .

diagram

Also , you can see on which methods you should focus to refactor – the ones with the highest cyclomatic complexity.

diagram

https://learn.microsoft.com/en-us/visualstudio/code-quality/code-metrics-cyclomatic-complexity?view=vs-2022

Install from https://nuget.org/packages/netpackageanalyzerconsole

NetPackageAnalyzer–part 11–Building Blocks , Test Projects and Root Projects

The .NET Tool , https://www.nuget.org/packages/netpackageanalyzerconsole , can now analyze a solution and see the Building Blocks , Test Projects and Root Projects

Building blocks Projects

I define as Building blocks projects the projects that have no reference to other projects.

If you are new to the solution , then you can start to those base projects – should be self contained and self explanatory

diagram

Root Projects

I define as root projects the projects that are not referenced by any other project and that are not test projects

Can be console, winforms, windows api, mobile , services … Important is that they contain the functionality for the business

diagram

Test Projects

The application shows test projects and the projects that are tested.

diagram

Install from https://nuget.org/packages/netpackageanalyzerconsole

NetPackageAnalyzer- idea –part 1

I wanted to have a tool that can analyze a C# solution with all the dependencies ( project relations, packages, commits)

It generates a graph of the dependencies for

  • the packages of your solution ( and see when the major version of a package differs between projects)

  • the projects of your solution.
  • the project dependencies of each project.

Along with the graph, it also generates

  • a report for the commits of the solution per years.

  • a report for outdated/deprecated packages per solution.
  • building blocks for the solution – you can start from here to understand the solution

If you want to see how it looks like, you can see how he analyses himself at Analyzer

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.