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é.

Votre message a été envoyé.

Nous vous répondrons à

Si vous n'avez toujours pas reçu de réponse, vérifiez votre dossier
Spam/Junk et cliquez sur le bouton "Not Spam".
De cette façon, vous ne manquerez la réponse de notre équipe.

The first step towards PVS-Studio for C#

The first step towards PVS-Studio for C#

30 Sep 2015

The PVS-Studio team would like to share some news and heat up the audience interest a bit. We have started C# analyzer development. From the user's point of view it'll still be our good old PVS-Studio, but now we'll teach it how to look for bugs in C# programs.


At this moment (September, 2015) the PVS-Studio analyzer supports Visual Studio 2005-2015 and can analyze C, C++, C++/CLI, C++/CX (WinRT) programs. Also the PVS-Studio Standalone utility allows checking projects which are built not only with Visual C++, but also with MinGW, for instance. There were some experiments in running PVS-Studio on Linux, but it's not of a big interest to us, as it's quite hard to make profit in the Linux world by means of creating developer tools. We have a bigger liking for Windows, that's why we decided to bring some joy to C# developers.

We've said many times that the C# language is less subject to errors. In this language there were changed or removed many constructions that are enough to shoot yourself in the foot by banal or exotic means. But we know that there is no developer who is totally immune to inadvertence, typos and slip ups.

The PVS-Studio is famous for its diagnostics which allow you to detect typos, Copy-Paste related errors and many more. So we've decided to use our experience in analysis and create a nice handy tool for C# as well.

Today we've heard the birth cry of C# PVS-Studio. We have adapted our favorite V501 diagnostic for C#. It has lots of great findings on its credit. And here is the very first result. Having launched PVS-Studio on MSBuild project we found such an issue:

public int Compare(ITaskItem x, ITaskItem y)
  if (x.ItemSpec != y.ItemSpec)
    return -1;

  if (x.CloneCustomMetadata().Count !=
    return -1;

PVS-Studio warning: V3001 There are identical sub-expressions to the left and to the right of the '!=' operator x.CloneCustomMetadata().Count != x.CloneCustomMetadata().Count. Microsoft.Build.Engine.UnitTests TaskItemComparer.cs 51

By accident the 'x' variable is used twice. Correct variant:

if (x.CloneCustomMetadata().Count !=

Of course, it's one of the first steps along the way of creating a great tool for C# programmers. But we feel enough strength and wish to make it to the end.

We plan to have the first C# version released by the New Year. Of course by this time we will have only a several diagnostics implemented which will be mainly taken from the C++ module. But even with the help of this New Year version you'll be able to find quite a number of amusing errors. Then gradually we will implement other diagnostics that can be adapted for C#. Later on there will appear some specific diagnostics, applicable only to C# code.

Note: As soon as C++ & C# version is released we plan to cease supporting Visial Sudio 2005, 2008. It becomes more and more troublesome for us due to some technical and organizational reasons.

Most likely there will be questions concerning the technology that the analyzer will be built upon. Here is the answer. We are using Roslyn.

Thanks a lot for your attention. For those C# programmers who are not aware of what PVS-Studio is and what it's capable of, I'll give a recommendation to visit this section. I'm sure it'll impress you and you'll want to try out the PVS-Studio on your C# projects.

Comments (0)

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