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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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.

>
>
Examples of errors detected by the V300…

Examples of errors detected by the V3005 diagnostic

Apr 05 2021

V3005. The 'x' variable is assigned to itself.


Umbraco

V3005 The 'member.UpdateDate' variable is assigned to itself. MemberService.cs 114


public void SavePassword(IMember member, string password)
{
  ....
  member.RawPasswordValue = result.RawPasswordValue;
  member.LastPasswordChangeDate = result.LastPasswordChangeDate;
  member.UpdateDate = member.UpdateDate;
}

Similar errors can be found in some other places:

  • V3005 The 'user.UpdateDate' variable is assigned to itself. UserService.cs 269

SharpDevelop

V3005 The 'linearGradientBrush.GradientStops' variable is assigned to itself. BrushEditor.cs 120


void DetermineCurrentKind()
{
  ....
  else if (Brush is LinearGradientBrush) {
    linearGradientBrush = Brush as LinearGradientBrush;
    radialGradientBrush.GradientStops =
      linearGradientBrush.GradientStops;
    CurrentKind = BrushEditorKind.Linear;
  }
  else if (Brush is RadialGradientBrush) {
    radialGradientBrush = Brush as RadialGradientBrush;
    linearGradientBrush.GradientStops =      // <=
      linearGradientBrush.GradientStops;     // <=
    CurrentKind = BrushEditorKind.Radial;
  }
}

Most likely this is what should be written here: linearGradientBrush.GradientStops = radialGradientBrush.GradientStops;


SharpDevelop

V3005 The 'this.WhiteSpaceText' variable is assigned to itself. WhitespaceNode.cs 65


public WhitespaceNode(string whiteSpaceText,
                      TextLocation startLocation)
{
  this.WhiteSpaceText = WhiteSpaceText;
  this.startLocation = startLocation;
}

Lower case 'w' should have been used instead of capital 'W'. Correct variant: this.WhiteSpaceText = whiteSpaceText;


MonoDevelop

V3005 The 'MacroCharacter' variable is assigned to itself. Mono.TextEditor ViMacro.cs 57


public ViMacro (char macroCharacter) {
  MacroCharacter = MacroCharacter;
}

public char MacroCharacter {get; set;}

MonoDevelop

V3005 The 'MarkCharacter' variable is assigned to itself. Mono.TextEditor ViMark.cs 45


public ViMark (char markCharacter) {
  MarkCharacter = MarkCharacter;
}

public char MarkCharacter {get; set;}

MonoDevelop

V3005 The 'this.WhiteSpaceText' variable is assigned to itself. ICSharpCode.NRefactory.CSharp WhitespaceNode.cs 65


public WhitespaceNode(string whiteSpaceText,
                      TextLocation startLocation)
{
  this.WhiteSpaceText = WhiteSpaceText;
  this.startLocation = startLocation;
}

public string WhiteSpaceText { get; set; }

MonoDevelop

V3005 The 'iconMargin.IsVisible' variable is assigned to itself. MonoDevelop.HexEditor HexEditor.cs 241


void OptionsChanged (object sender, EventArgs e)
{
  gutterMargin.IsVisible = Options.ShowLineNumberMargin;
  iconMargin.IsVisible = iconMargin.IsVisible;
  ....
}

public bool IsVisible { get; set; }

IronPython and IronRuby

V3005 The 'd["latin1"]' variable is assigned to itself. StringOps.cs 1905


private static Dictionary<string, EncodingInfoWrapper>
  MakeCodecsDict() {
  ....
  switch (normalizedName) {
    case "iso_8859_1":
      d["8859"] = d["latin_1"] = d["latin1"] =
      d["iso 8859_1"] = d["iso8859_1"] = d["cp819"] =
      d["819"] = d["latin"] = d["latin1"] = d["l1"] =
      encs[i];
      break;
  ....
}

.NET Compiler Platform ("Roslyn")

V3005 The 'Name' variable is assigned to itself. AsynchronousOperationListener.DiagnosticAsyncToken.cs 32


public DiagnosticAsyncToken(
  AsynchronousOperationListener listener,
  string name,
  object tag,
  string filePath,
  int lineNumber)
  : base(listener)
{
  Name = Name;
  Tag = tag;
  FilePath = filePath;
  LineNumber = lineNumber;
  StackTrace = PortableShim.StackTrace.GetString();
}

Sony ATF

V3005 The 'ProgressError' variable is assigned to itself. Atf.Gui.Wpf.vs2010 StatusService.cs 24


public ProgressCompleteEventArgs(Exception progressError,
                                 object progressResult,
                                 bool cancelled)
{
  ProgressError = ProgressError;
  ProgressResult = progressResult;
  Cancelled = cancelled;
}

Sony ATF

V3005 The 'window.Left' variable is assigned to itself. Atf.Gui.Wpf.vs2010 DockPanel.cs 706


public double Left { get; set; }

public void ApplyLayout(XmlReader reader)
{
  ....
  FloatingWindow window = new FloatingWindow(
                                this, reader.ReadSubtree());
  ....
  window.Left = window.Left;
  window.Top = window.Top;
  ....
}

Sony ATF

V3005 The 'window.Top' variable is assigned to itself. Atf.Gui.Wpf.vs2010 DockPanel.cs 707


public double Top  { get; set; }

public void ApplyLayout(XmlReader reader)
{
  ....
  FloatingWindow window = new FloatingWindow(
                                this, reader.ReadSubtree());
  ....
  window.Left = window.Left;
  window.Top = window.Top;
  ....
}

Xenko

V3005 The 'hashCode' variable is assigned to itself. SiliconStudio.Xenko ParameterKeys.cs 346


public ParameterComposedKey(ParameterKey key,
                            string name,
                            int indexer)
{
  Key = key;
  Name = name;
  Indexer = indexer;

  unchecked
  {
    hashCode = hashCode = Key.GetHashCode();
    hashCode = (hashCode * 397) ^ Name.GetHashCode();
    hashCode = (hashCode * 397) ^ Indexer;
  }
}

WPF samples by Microsoft

V3005 The 'clipboardInfo.Text' variable is assigned to itself. MainWindow.cs 204


private void DumpAllClipboardContentsInternal()
{
  ....
  if (dataObject == null)
  {
    clipboardInfo.Text =
      clipboardInfo.Text =
        "Can't access clipboard now!
          \n\nPlease click Dump All Clipboard
              Contents button again.";
  }
  else
  {
     ....
}

Old NASA World Wind (C#)

V3005 The 'num1' variable is assigned to itself. PlaceFinder.cs 2011


public static bool SearchForAddress(....)
{
  double num1;
  long2 = num1 = 0;
  long1 = num1 = num1;  // <=
  lat2  = num1 = num1;  // <=
  lat1 = num1;
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'num1' variable is assigned to itself. PlaceFinder.cs 2012

MSBuild

V3005 The '_nextProjectId' variable is assigned to itself. LoggingService.cs 325


public int NextProjectId
{
  get
  {
    lock (_lockObject)
    {
      _nextProjectId = _nextProjectId += MaxCPUCount + 2;  // <=
      return _nextProjectId;
    }
  }
}

PascalABC.NET

V3005 The 'miGenerateRealization.Visible' variable is assigned to itself. VisualPascalABCNET OptionsManager.cs 342


public void UpdateUserOptions()
{
  ....
  tsViewIntellisensePanel.Visible =
  .... =
  miGenerateRealization.Visible =
  miGenerateRealization.Visible =
  ....;
}

Similar errors can be found in some other places:

  • V3005 The 'visitNode' variable is assigned to itself. SyntaxVisitors SimplePrettyPrinterVisitor.cs 106

SubtitleEdit

V3005 The 'positionInfo' variable is assigned to itself. WebVTT.cs 79


internal static string GetPositionInfoFromAssTag(Paragraph p)
{
  ....
  if (!string.IsNullOrEmpty(line))
  {
    if (positionInfo == null)
      positionInfo = " line:" + line;
    else
      positionInfo = positionInfo += " line:" + line;
  }
  ....
}

Azure PowerShell

V3005 The 'this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent' variable is assigned to itself. SetAzureVMOperatingSystemCommand.cs 298


public override void ExecuteCmdlet()
{
  ....
  // OS Profile
  this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent =
    this.VM.OSProfile.WindowsConfiguration.ProvisionVMAgent;
  ....
}

[JsonProperty(PropertyName = "provisionVMAgent")]
public bool? ProvisionVMAgent { get; set; }

Azure PowerShell

V3005 The 'this.LastHeartbeat' variable is assigned to itself. PSFabricDetails.cs 804


public ASRInMageAzureV2SpecificRPIDetails(
  InMageAzureV2ReplicationDetails details)
{
  this.LastHeartbeat = this.LastHeartbeat;  // <=
  this.RecoveryAvailabilitySetId = details.RecoveryAvailabilitySetId;
  this.AgentVersion = details.AgentVersion;
  this.DiscoveryType = details.DiscoveryType;
  ....
}

public DateTime? LastHeartbeat { get; set; }

public class InMageAzureV2ReplicationDetails :
  ReplicationProviderSpecificSettings
{
  ....
  [JsonProperty(PropertyName = "lastHeartbeat")]
  public DateTime? LastHeartbeat { get; set; }
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'this.ResourceGroupName' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 84
  • V3005 The 'this.ExpressRouteGatewayName' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 85
  • V3005 The 'this.Name' variable is assigned to itself. RemoveAzureRmExpressRouteConnectionCommand.cs 86

OpenCvSharp

V3005 The 'optimumChannels[PixelFormats.Indexed1]' variable is assigned to itself. WriteableBitmapConverter.cs 22


static WriteableBitmapConverter()
{
  optimumChannels = new Dictionary
                    <PixelFormat, int>();
  optimumChannels[PixelFormats.Indexed1] =         // <=
  optimumChannels[PixelFormats.Indexed8] =         // <=
  optimumChannels[PixelFormats.Gray2] =
  optimumChannels[PixelFormats.Gray4] =
  optimumChannels[PixelFormats.Gray8] =
  optimumChannels[PixelFormats.Gray16] =
  optimumChannels[PixelFormats.Gray32Float] =
  optimumChannels[PixelFormats.Indexed1] =         // <=
  optimumChannels[PixelFormats.Indexed2] =
  optimumChannels[PixelFormats.Indexed4] =
  optimumChannels[PixelFormats.Indexed8] =         // <=
  ....
  optimumTypes = new Dictionary
                 <PixelFormat, MatType>();
  optimumTypes[PixelFormats.Indexed1] =            // <=
  optimumTypes[PixelFormats.Indexed8] =            // <=
  optimumTypes[PixelFormats.Gray2] =
  optimumTypes[PixelFormats.Gray4] =
  optimumTypes[PixelFormats.Gray8] =
  optimumTypes[PixelFormats.Indexed1] =            // <=
  optimumTypes[PixelFormats.Indexed2] =
  optimumTypes[PixelFormats.Indexed4] =
  optimumTypes[PixelFormats.Indexed8] =            // <=
  optimumTypes[PixelFormats.BlackWhite] =
  ....
}
....
public static class PixelFormats
{
  ....
  public static PixelFormat Indexed8 { get; }
  ....
  public static PixelFormat Indexed1 { get; }
  ....
}

Similar errors can be found in some other places:

  • V3005 The 'optimumChannels[PixelFormats.Indexed8]' variable is assigned to itself. WriteableBitmapConverter.cs 23
  • V3005 The 'optimumTypes[PixelFormats.Indexed1]' variable is assigned to itself. WriteableBitmapConverter.cs 50
  • V3005 The 'optimumTypes[PixelFormats.Indexed8]' variable is assigned to itself. WriteableBitmapConverter.cs 51

Emby

V3005 The '_validProviderIds' variable is assigned to itself. BaseNfoParser.cs 77


private Dictionary<string, string> _validProviderIds;
....
public void Fetch(....)
{
  ....
  _validProviderIds = _validProviderIds = new Dictionary<....>(....);
  ....
}

Chocolatey

V3005 The 'Provider' variable is assigned to itself. CrytpoHashProviderSpecs.cs 38


public abstract class CrytpoHashProviderSpecsBase : TinySpec
{
  ....
  protected CryptoHashProvider Provider;
  ....
  public override void Context()
  {
    Provider = Provider = new CryptoHashProvider(FileSystem.Object);
  }
}

QuantConnect Lean

V3005 The '_factory' variable is assigned to itself. ZipEntryNameSubscriptionDataSourceReader.cs 50


private readonly SubscriptionDataConfig _config;
private readonly DateTime _date;
private readonly bool _isLiveMode;
private readonly BaseData _factory;

public ZipEntryNameSubscriptionDataSourceReader(
    SubscriptionDataConfig config,
    DateTime date,
    bool isLiveMode)
{
  _config = config;
  _date = date;
  _isLiveMode = isLiveMode;
  _factory = _factory = config.GetBaseDataInstance(); // <=
}

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…
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…
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…
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 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…
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…
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…
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…
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…
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…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
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 →
Accept