NDepend

Improve your .NET code quality with NDepend

Debugging a .NET App on Linux from Windows Visual Studio with WSL

NDepend analysis, reporting, API and Power-Tools will run on Linux and MacOS with the next version 2021.2. To achieve that, a major refactoring session has been achieved to isolate code...
Patrick Smacchia September 15, 2021

Code Testability: A Case Study

[crayon-614d1e8fda70a971188641/] This method is untestable because its logic depends on NdpOperatingSystem.Kind which returns an OSPlatform object. Notice the usage of the attribute UncoverableByTest that lets code reviewers and tools like...
Patrick Smacchia September 1, 2021

3 productivity Resharper features missing in Visual Studio

Resharper is a great Visual Studio productivity extension but on the other hand it slows down significantly the IDE, especially when working with large solutions. However there are real hopes...
Patrick Smacchia August 10, 2021

Top 10 New .NET 6.0 API

.NET 6 introduces new handy APIs that will make our development journey easier. Let’s go through the top 10 new API in terms of usage likelyhood. Then in the conclusion,...
Patrick Smacchia July 7, 2021

How to Logically Name Embedded Resources in .csproj?

You can work with .NET for two decades and still discover some useful stuff.  One thing that bothered me till now is that an embedded resource name is “the project...
Patrick Smacchia June 16, 2021

On replacing Thread.Abort() in .NET 6, .NET 5 and .NET Core

Thread.Abort() is not supported in .NET 5 / .NET Core We are actually migrating the NDepend analysis and reporting to .NET 5 and figured out that there is no equivalent...
Patrick Smacchia May 19, 2021

Visual Studio 2022 64 bits: Elements of history

Finally after all these years of waiting Visual Studio 2022 will run in a 64 bits process on 64 bits machines! As a consequence the effective process address space of the...
Patrick Smacchia May 11, 2021

Covariance and Contravariance in C# Explained

Introduction This article explains and demonstrates the concepts of Covariance and Contravariance in C# .NET. These concepts will be first introduced for generics, then for delegates and finally for arrays....
Patrick Smacchia May 4, 2021

6 Reasons Visual Studio Theme Affects Productivity

Themes can be fascinating. Humans are vulnerable to attachments. It could be anything – person, thing, color, food, etc. some people are attracted to unique colors that make them feel...
Patrick Smacchia April 14, 2021

Clean Architecture for ASP.NET Core Solution: A Case Study

In this post I’ll explore the Jason Taylor’s CleanArchitecture .NET solution template available here on github. It constitutes a good template and it is based on several modern industry wide...
Patrick Smacchia March 24, 2021

Visual Studio IntelliCode : AI Assisted Coding

We are all amazed by recent progresses made possible thanks to Artificial Intelligence (AI). In 2017 Microsoft announced Visual Studio IntelliCode which used Machine Learning (ML) to predict code completions,...
Patrick Smacchia January 19, 2021

How we quickly refactored with Resharper more than 23.000 calls to Debug.Assert() into more meaningful assertions

Since the NDepend inception more than 15 years ago, we stuffed our code with calls to Debug.Assert(). This results today in more than 23.000 assertions calls. Few developers realize that...
Patrick Smacchia January 11, 2021

The proper usages of the keyword ‘static’ in C#

The keyword static is somewhat awkward in a pure Oriented-Object world. I would like to explain here what are the right usages of static I came up after 25 years of...
Patrick Smacchia December 8, 2020

Using C#9 record and init property in your .NET Framework 4.x, .NET Standard and .NET Core projects

C#9 record and C#9 init property are really nice addition to the language. As explained in C#9 records: immutable classes, both are syntactic sugar that don’t require any change at...
Patrick Smacchia November 25, 2020

C# Index and Range Operators Explained

C#8 added the index ^ and range .. operators. In this post I am attempting to demystify both in the most comprehensive way. The index operator ^ Let’s start with...
Patrick Smacchia November 16, 2020

Visualize Code with Software Architecture Diagrams

The source code is the design. This famous motto means that no matter how many diagrams you draw and discuss with your colleagues, what matters is how the existing source...
Patrick Smacchia November 10, 2020

Strategies to Catch Regression Bugs before Production: A Case Study

That’s quite a coincidence that a few days after promoting the joy of immutability in the post C#9 records: immutable classes we stumbled on a bug due to a mutable...
Patrick Smacchia October 19, 2020

C#9 records: immutable classes

Record is a long time awaited feature now proposed by C# 9. Finally we have a concise syntax to express this: [crayon-614d1e8fdc494435857326/] Isn’t it beautiful? In the NDepend code itself...
Patrick Smacchia October 12, 2020

.NET 5.0 App Trimming and Potential for Future Progress

In this article we will: go through the various ways to publish a .NET 5.0 application, play with .NET 5.0 app trimming to reduce the size of our deliverable use...
Patrick Smacchia September 28, 2020

Architecture of a C# game rendered with Blazor, Xamarin, UWP, WPF, and Winforms

When I wrote my last post Blazor Internals you need to know I came across this great project on github: AsteroidsWasm. This project is a remake in C# of the...
Patrick Smacchia September 15, 2020

14 Visual Studio Web Development Productivity Tips

Visual Studio proposes quite a few handy tools to boost your productivity as a web developer. Here are some tips focused around web code edition and web application starting and...
Patrick Smacchia July 28, 2020

10 Visual Studio Files and Layout Productivity Tips

Nowadays most developers are working remotely. Hence the monitor(s) configuration might have changed, and might change frequently. In this context, it does matter to optimize the Visual Studio layout and...
Patrick Smacchia July 21, 2020

10 Visual Studio Navigation Productivity Tips

A large code base is a complex asset. Visual Studio is a complex environment. In this context developers spend a significant part of their time searching and navigating across code...
Patrick Smacchia July 14, 2020

Top 10 Visual Studio Refactoring Tips

With the version 2019 Visual Studio is now mature when it comes to refactoring. This post proposes a tour of the top 10 most used refactoring actions in my opinion....
Patrick Smacchia July 7, 2020

12 Visual Studio Debugging Productivity Tips

In this post we assume the the reader knows the basics of debugging with Visual Studio: F5 to start running with the debugger F9 set breakpoint on the current line...
Patrick Smacchia June 30, 2020

10 Visual Studio Ninja Code Editor Productivity Tips

Among the multiple daily development tasks (planning, testing, refactoring, bug fix…) code edition is arguably the most satisfying one. Code edition can be even more satisfying and productive by mastering...
Patrick Smacchia June 24, 2020

10 Visual Studio Solution Explorer Productivity Tips

The Visual Studio Solution Explorer panel is like home for Visual Studio users. It presents all projects, source files and items thanks to a treeview layout. This panel is quite...
Patrick Smacchia June 17, 2020

Don’t rely on someone else to protect your software

This morning I stumbled on this post Decompilation of C# code made easy with Visual Studio on the Visual Studio blog. Basically VS will soon be able to not only...
Patrick Smacchia February 20, 2020

4 Predictions for the Future of .NET

In May 2019, Microsoft officially announced .NET 5, the future of .NET: it will be based on all the .NET Core work already achieved. Here is the schedule announced: On...
Patrick Smacchia October 8, 2019

Identify .NET Code Structure Patterns with no Effort

The two pillars of code maintainability are automatic testing and clean code structure. Testing is used to regularly challenge code correctness and detect regression early. Testing can be easily assessed...
Patrick Smacchia July 16, 2019
open