To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (an extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

Finally! PVS-Studio supports .NET 5 pro…

Finally! PVS-Studio supports .NET 5 projects

Apr 21 2021

On November 10th, 2020, Microsoft released a new version of .NET Core - .NET 5. The updated platform presents many new enhancements. For example, it allows C# developers to use features the new C# 9 offers: records, relational pattern matching, etc. Unfortunately, there was a disadvantage: PVS-Studio could not analyze these projects. However (and here's the good news)... That used to be the case :) Our next release, PVS-Studio 7.13, will support projects that target .NET 5.


Aka .NET Core 4

.NET 5 is the next step after .NET Core 3.1. We can see that Microsoft changed the name from .NET Core to .NET. This is to show that they will focus on this platform further on. Microsoft basically confirmed this on their official website – they've already posted three preview versions of .NET 6 there.

But why did the version number go from 3.1 to 5? This does not seem surprising - remember how Windows 10 followed Windows 8.1? :)

In fact, Microsoft skipped number 4 to avoid confusion between .NET Framework and .NET. However, "Entity Framework Core 5.0", based on .NET 5, will keep its "Core" postfix. Otherwise it would not be possible to differentiate between Core and Framework versions of "Entity Framework 5.0".

.NET 5 supplies developers with many new tools. For example, C# now offers an enhanced pattern matching mechanism. Then there is this unusual and interesting feature that enables you to write code outside of functions or classes. Not every developer needs this capability, but it's bound to attract some fans. A full list of C# 9 enhancements is available on Microsoft's official website.

You can read about new features in .NET 5 here.

PVS-Studio and .NET 5

We received many requests from our clients to support .NET 5 projects. We also understood that the analyzer must support the latest innovations. However, although important, new .NET versions are not PVS-Studio's only direction for development. This is why it took us a while to present our new version that supports .NET 5 projects.

The upgrade concerns our analyzer versions for Windows, Linux and macOS. PVS-Studio for Windows still requires .NET Framework 4.7.2. On Linux and macOS, the analyzer now requires .NET 5. Previously, .NET Core 3.1 was sufficient.

Why did we switch the analyzer for Linux and macOS to .NET 5?

Our initial plan was to switch the analyzer from .NET Core 3.1 to .NET 5 at a later time. However, this had to change when we encountered a problem.

When analyzing projects for .NET Core or .NET 5, PVS-Studio actively interacts with the corresponding version's SDK. The tricky thing is, .NET 5 SDK libraries depend on the .NET 5 version's "System.Runtime" library. Meanwhile, if the analyzer targets .NET Core 3.1, it loads the 3.1 version's "System.Runtime" library. As a result, we kept getting a conflict - the analyzer could not interact with the SDK library, and the analysis was not possible.

Switching from .NET Core to .NET 5 completely resolved this problem. :)

Instantaneous enhancements

To support .NET 5 project analysis we needed to update some dependencies. Specifically, PVS-Studio now uses newer Roslyn and MSBuild versions. This enables the analyzer to process code, that uses C# 9 features, correctly. For example, the code below could trigger false warnings:

user = user with { Name = "Bill" }

The analyzer did not have any information about WithExpression - and thus could not process this code correctly. As a result the analyzer issued a warning that the user variable was assigned to itself. Of course, the analysis report also contained a warning that the analyzer did not support this project. However, the latter did not make things easier. :( Luckily, the new update fixed the problem automatically. Other problems we had to fix manually.

Problems with new versions

To stay up-to-date, the static analyzer needs to adapt to new language versions. The analyzer's developers cannot foresee all features a language may get in the future. To support a new language version, the analyzer needs more than just correct parsing and semantics structure. The analyzer's developers also need to review the tool's code, evaluate the use of various internal technologies and diagnostic rules. The analyzer will likely require additional changes after a new language version comes out.

One of the new - and problematic - C# features is top-level statements. When working on the C# analyzer, we expected that local variables, conditions, loops, etc. are always inside methods. Now that you can write C# code even without declaring a class... Obviously, this is something very interesting, but it creates some problems for us. Though we doubt that all developers will start to write all code outside of classes. :)

Another new feature that prompted us to change our tool's code is the init accessor. We had to rework the V3140 diagnostic rule.

The rule is triggered when a property's accessors use different internal variables. The code sample below (from the RunUO Check article) triggers this diagnostic:

private bool m_IsRewardItem;

[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
  get{ return m_IsRewardItem; }
  set{ m_IsRewardItem = value; InvalidateProperties(); }

private bool m_East;

[CommandProperty( AccessLevel.GameMaster )]
public bool East                                       // <=
  get{ return m_East; }
  set{ m_IsRewardItem = value; InvalidateProperties(); } 

PVS-Studio warns: V3140 Property accessors use different backing fields. WallBanner.cs 77

When writing the V3140 diagnostic, we assumed that a property can have only two accessors - get and set. The new init accessor went outside this expectation. This did not just cause the diagnostic's incorrect operation - the diagnostic kept crashing and throwing an exception! Luckily, we caught this problem when testing - and fixed it successfully.


Can't wait for the release?

You do not have to wait! Of course, now it's not too long before the release, but still... Don't you want to try the new version as soon as possible? No problem - we are eager to help! Go to the feedback page and request the new version. We'll try to respond as soon as possible - which means soon you can analyze your (and not yours only) .NET 5 projects!

We also encourage you to share your impression about PVS-Studio. Whatever your experience with the analyzer, we would like to know about it. After all, it is largely thanks to user reviews that PVS-Studio develops and becomes better.

Popular related articles
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
Static analysis as part of the development process in Unreal Engine

Date: Jun 27 2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Appreciate Static Code Analysis!

Date: Oct 16 2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →