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-614f1c27762a7154837787/] 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

What is Code Review? – Guidelines and Best Practices

Code review is the process of mandating systematically one or several developers to review the code written by another developer in other to detects defect and to improve it. Code...
Patrick Smacchia July 19, 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

In the Jungle of .NET Obfuscator Tools

In this article I will explain our genuine experience with various .NET Obfuscator Tools. There are actually dozens of .NET Obfuscator as listed here obviously we didn’t try them all....
Patrick Smacchia June 8, 2021

Migrating Delegate.BeginInvoke Calls to .NET Core, .NET 5 and .NET 6

In this 2019 post, the .NET Base Class Library engineers announced that the good old Delegate.BeginInvoke .NET Framework syntax wasn’t supported in .NET Core and consequently in .NET 5, 6...
Patrick Smacchia May 26, 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

Clean Architecture Refactoring: A Case Study

Introduction to Clean Architecture The recent post Clean Architecture for ASP.NET Core Solution: A Case Study explained that one of the most interesting property promoted by Clean Architecture is the...
Patrick Smacchia April 27, 2021

Hungarian Notation for Fields in C#

If there is one topic that divides the C# developers community, it is the Hungarian notation for fields. In our team we rely on Hungarian notation for fields, not just...
Patrick Smacchia April 21, 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

Implementing a Domain with POCO (Plain Old CLR Objects)

Here is a remark I noticed on my recent post Clean Architecture for ASP.NET Core Solution: A Case Study and I’d like to detail a bit this here: “The article...
Patrick Smacchia April 8, 2021

8 Books to Improve as a .NET Developer

Nowadays all information a developer needs to know is available online for free. Blogposts and videos authored by experts, giant questions and answers websites, a quick search and you get...
Patrick Smacchia March 31, 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

How to Plan Large-Scale Refactoring?

  The .NET platform exists for two decades and nowadays the technology is evolving faster than ever. It is now time for serious .NET applications to be refactored to run...
Patrick Smacchia February 23, 2021

10 Reasons Why You Should Write Tests

As many, I started programming when I was a child 3 decades years ago. With no doubt, the most important practice I’ve adopted during my professional career is to write...
Patrick Smacchia February 9, 2021

Include IL Offset into Production Exception Stack Traces

In a previous post The proper usages of Exceptions in C# I explained that it is important to get as much information as possible from production crash logs. One such...
Patrick Smacchia February 2, 2021

Is Artificial Intelligence Assisted Coding the Next Developer Productivity Silver Bullet?

The famous Fred Brooks paper “No Silver Bullet – Essence and Accident in Software Engineering“ published in 1987 stated that: “there is no single development, in either technology or management technique,...
Patrick Smacchia January 26, 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 Exceptions in C#

The C# exception basics are generally well understood. However exceptions are often used as a way to sweep error handling duty under the carpet. As I did in The proper...
Patrick Smacchia December 16, 2020

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

Code Smell – Primitive Obsession and Refactoring Recipes

Primitives are the real building blocks of your class and its use is obviously inevitable. But the real problem starts when they are not used properly. When you define Class,...
Patrick Smacchia December 1, 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

When your brain can’t handle the complexity: NDepend and PostSharp

The size and complexity of codebases have exploded in the last decade. What can you do when your codebase no longer fits your brain? In this article I’ll suggest two...
Patrick Smacchia November 2, 2020
open