Pour obtenir une clé
d'essai remplissez le formulaire ci-dessous
Demandez des tariffs
Nouvelle licence
Renouvellement de licence
--Sélectionnez la devise--
* En cliquant sur ce bouton, vous acceptez notre politique de confidentialité

Free PVS-Studio license for Microsoft MVP specialists
To get the licence for your open-source project, please fill out this form
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

I am interested to try it on the platforms:
** En cliquant sur ce bouton, vous acceptez notre politique de confidentialité.

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.

PVS-Studio C#: what to do if project pr…

PVS-Studio C#: what to do if project preparation takes too long or freezes?

07 Sep 2021

Some users of the PVS-Studio C# analyzer faced a problem: the project preparing stage either took much time or even froze. This article covers how the problem manifested itself and how we fixed it.

What was the problem?

The problem could manifest itself in different ways. It depended on the tools that used the C# analyzer (Visual Studio, Rider, the command line). The problem's typical sign – is, the project preparation process either takes too much time or doesn't finish at all.

Visual Studio

The following window shows how the project preparation can freeze. The progress bar either does not move, or moves at a snail's pace:



The "PVS-Studio: Preparing for analysis" step is processed in the "Background Tasks" window below. We have no progress:


Command-line (PVS-Studio_Cmd.exe / pvs-studio-dotnet)

When we start the command-line version (PVS-Studio_Cmd.exe for Windows or pvs-studio-dotnet for Linux or macOS), we have no progress after starting the analyzer (even with the '--progress' flag):


Root of the problem

The analyzer has code that processes projects' dependencies on each other, including transitive ones. Everything seems fine, but the analyzer did not take into account which projects had already been processed, which ones had not. As a result, processing could start repeatedly for the same project, if it often appeared in the transitive dependencies of other projects.

Let's say we have 3 projects: 'A', 'B', 'C'. The 'A' project depends on 'B' and 'C', 'B' – on 'C', 'C' doesn't depend on anything. Here's what happened. During the 'C' project analysis, the analyzer processed 1 project ('C' itself). During 'B' - 2 projects ('B' and 'C'), in the case of 'A' - 4 projects ('A', 'B' and 'C' as direct dependencies and 'C' as a transitive dependency of project 'B'). You see what kind of sequence is showing up? 1, 2, 4, 8, 16, 32, 64...

Sometimes, the analyzer tried to process hundreds of thousands and even millions of dependencies. If we were lucky, the analyzer just worked for a long time. If we were unlucky, the project preparing stage could take more than a few days.

The solution was simple – the analyzer did not need to process the same projects repeatedly.

This simple fix solved the problems of several users at once:

  • in some cases, the project preparation stage actually started to work, although earlier the analyzer simply froze;
  • for someone, the fix significantly sped up project preparation. For example, 4 minutes instead of 2 hours.

What to do?

PVS-Studio 7.14 or earlier

In this case, upgrade to the analyzer's most recent version:

  • try PVS-Studio 7.15 or the latest version, if it is available at the time you're reading this article. Check the latest available version, as well as download the analyzer, here.
  • if 7.15 has not been released yet, write to us. We'll provide you with the analyzer beta where this problem is solved.

PVS-Studio 7.15 or later

In this case, you're facing a problem we don't know about yet. Please write to us - we will try to sort it out.

Popular related articles
Sorting in C#: OrderBy.OrderBy or OrderBy.ThenBy? What's more effective and why?

Date: 20 Sep 2022

Author: Sergey Vasiliev

Suppose we need to sort the collection by multiple keys. In C#, we can do this with the help of OrderBy().OrderBy() or OrderBy().ThenBy(). But what is the difference between these calls? To answer th…
ML.NET: can Microsoft's machine learning be trusted?

Date: 08 Sep 2022

Author: Andrey Moskalev

In 2018, Microsoft created ML.NET, a machine learning framework for .NET developers. Since then, the machine learning library has undergone significant changes and acquired new features to identify p…
The risks of using vulnerable dependencies in your project, and how SCA helps manage them

Date: 06 Sep 2022

Author: Nikita Lipilin

Most applications today use third-party libraries. If such a library contains a vulnerability, an app that uses this library may also be vulnerable. But how can you identify such problematic dependen…
Build to order? Checking MSBuild for the second time

Date: 01 Sep 2022

Author: Nikita Panevin

MSBuild is a popular open-source build platform created by Microsoft. Developers all over the world use MSBuild. In 2016, we checked it for the first time and found several suspicious places. Can we …
The Orchard Core threequel. Rechecking the project with PVS-Studio

Date: 25 Aoû 2022

Author: Aleksey Avdeev

In this article, we check the Orchard Core project with the help of the PVS-Studio static analyzer. We are going to find out if the platform code is as good as the sites created on its basis. May the…

Comments (0)

Next comments
Unicorn with delicious cookie
Nous utilisons des cookies pour améliorer votre expérience de navigation. En savoir plus