The PVS-Studio team wants to share the news and pre-heat interest. We have started developing an analyzer for C #. From the user's point of view, this will be the same old good PVS-Studio, but we will teach him to find errors in C # programs.
At the moment (September 2015), the PVS-Studio analyzer officially supports Visual Studio 2005-2015 and is able to analyze programs written in C, C ++, C ++ / CLI, C ++ / CX (WinRT). Also, the PVS-Studio Standalone utility allows you to check projects collected not only using Visual C ++, but also, for example, using MinGW. There are
experiments on launching PVS-Studio on Linux. However, the Linux direction is not interesting to us, since in the Linux world it is difficult to earn money on tools for developers. Our heart is closer to Windows, and we decided to please C # developers.
We have repeatedly said that C # code is less error prone. In this language, many constructions have been removed or changed, which allow in C ++ to shoot off their legs in both banal and exotic ways. However, no one is immune from misprints, lapses and inattention.
PVS-Studio analyzer is famous for its diagnostics, which allow to detect errors associated with typos, using Copy-Paste and so on. We decided to transfer our experience to C # and create an extremely useful tool.
')
Today we heard the first cry of a newborn. We adapted our favorite V501 diagnostics for C #. She has many glorious
finds . And here is the very first result. Having launched PVS-Studio on the MSBuild project, we found the first error in it:
public int Compare(ITaskItem x, ITaskItem y)
{
if (x.ItemSpec != y.ItemSpec)
{
return -1;
}
if (x.CloneCustomMetadata().Count !=
x.CloneCustomMetadata().Count)
{
return -1;
}
....
}
PVS-Studio: 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
'x'. :
if (x.CloneCustomMetadata().Count !=
y.CloneCustomMetadata().Count)
, C# . .
, C# . , C++ . . , C#. , C# .
. C++ & C#, Visual Studio 2005, 2008. .
, . .
Roslyn.
.
C# , , PVS-Studio , . , , PVS-Studio C# .