To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (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.

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

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

Sep 07 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
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
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…
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…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
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 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…
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…
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…
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…

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 →