Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
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

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
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 V3001 diagnostic

V3001. There are identical sub-expressions to the left and to the right of the 'foo' operator.


Umbraco

V3001 There are identical sub-expressions 'FocalPoint.Top != 0.5m' to the left and to the right of the '&&' operator. ImageCropDataSet.cs 58


public class ImageCropFocalPoint
{
  [DataMember(Name = "left")]
  public decimal Left { get; set; }

  [DataMember(Name = "top")]
  public decimal Top { get; set; }
}

public bool HasFocalPoint()
{
  return FocalPoint != null &&
         FocalPoint.Top != 0.5m && FocalPoint.Top != 0.5m;
}

Umbraco

V3001 There are identical sub-expressions 'node != null' to the left and to the right of the '&&' operator. BaseTree.cs 503


protected virtual void OnBeforeNodeRender(ref XmlTree sender,
                                          ref XmlTreeNode node,
                                          EventArgs e)
{
  if (node != null && node != null)
  {
    if (BeforeNodeRender != null)
      BeforeNodeRender(ref sender, ref node, e);
  }
}

Umbraco

V3001 There are identical sub-expressions 'key == ExifTag.WindowsTitle' to the left and to the right of the '||' operator. ExifPropertyCollection.cs 78


public void Set (ExifTag key, string value)
{
  if (items.ContainsKey (key))
    items.Remove (key);
  if (key == ExifTag.WindowsTitle ||         // <=
      key == ExifTag.WindowsTitle ||         // <=
      key == ExifTag.WindowsComment ||
      key == ExifTag.WindowsAuthor ||
      key == ExifTag.WindowsKeywords ||
      key == ExifTag.WindowsSubject) {
    items.Add (key, new WindowsByteString (key, value));
  ....
}

SharpDevelop

V3001 There are identical sub-expressions 'mc_a.Location.File' to the left and to the right of the '!=' operator. membercache.cs 1306


static
MemberCore GetLaterDefinedMember (MemberSpec a, MemberSpec b)
{
  var mc_a = a.MemberDefinition as MemberCore;
  var mc_b = b.MemberDefinition as MemberCore;

  ....

  if (mc_a.Location.File != mc_a.Location.File)
    return mc_b;

  return mc_b.Location.Row > mc_a.Location.Row ? mc_b : mc_a;
}

Microsoft Code Contracts

V3001 There are identical sub-expressions 'semanticType.Name == null' to the left and to the right of the '||' operator. ContractsProvider.cs 694


public bool TryGetTypeReference(....)
{
  ....
  if (semanticType.Name == null || semanticType.Name == null)
    goto ReturnFalse;
  cciType = new Microsoft.Cci.MutableCodeModel.NamespaceTypeR....
  {
    ContainingUnitNamespace = cciNamespace,
    GenericParameterCount = (ushort) (....),
    InternFactory = Host.InternFactory,
    IsValueType = semanticType.IsValueType,
    IsEnum = semanticType.TypeKind == TypeKind.Enum,
    Name = Host.NameTable.GetNameFor(semanticType.Name),
    TypeCode=CSharpToCCIHelper.GetPrimitiveTypeCode(semanticType)
  };
  goto ReturnTrue;'
  ....
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'semanticType.Name == null' to the left and to the right of the '||' operator. ContractsProvider.cs 714

MonoDevelop

V3001 There are identical sub-expressions 'string.IsNullOrEmpty (fixtureTypeName)' to the left and to the right of the '||' operator. MonoDevelop.NUnit NUnitProjectTestSuite.cs 84


protected override SourceCodeLocation
  GetSourceCodeLocation (string fixtureTypeNamespace,
                         string fixtureTypeName,
                         string methodName)
{
  if (string.IsNullOrEmpty (fixtureTypeName) ||
      string.IsNullOrEmpty (fixtureTypeName))
    return null;
  ....
}

MonoDevelop

V3001 There are identical sub-expressions 'doc.Editor != null' to the left and to the right of the '&&' operator. MonoDevelop.AspNet RazorCSharpParser.cs 180


bool TryAddDocument (string fileName,
         out OpenRazorDocument currentDocument)
{
  ....
  var guiDoc = IdeApp.Workbench.GetDocument (fileName);
  if (guiDoc != null && guiDoc.Editor != null)
  ....
  guiDoc.Closed += (sender, args) =>
  {
    var doc = sender as MonoDevelop.Ide.Gui.Document;
    if (doc.Editor != null && doc.Editor != null)
    ....
  }
  ....
}

MonoDevelop

V3001 There are identical sub-expressions 'mc_a.Location.File' to the left and to the right of the '!=' operator. ICSharpCode.NRefactory.CSharp membercache.cs 1319


static MemberCore
  GetLaterDefinedMember(MemberSpec a, MemberSpec b)
{
  var mc_a = a.MemberDefinition as MemberCore;
  var mc_b = b.MemberDefinition as MemberCore;
  if (mc_a == null)
    return mc_b;

  if (mc_b == null)
    return mc_a;

  if (a.DeclaringType.MemberDefinition !=
      b.DeclaringType.MemberDefinition)
    return mc_b;

  if (mc_a.Location.File != mc_a.Location.File)
    return mc_b;

  return mc_b.Location.Row > mc_a.Location.Row ? mc_b : mc_a;
}

MonoDevelop

V3001 There are identical sub-expressions 'resultIter != null' to the left and to the right of the '&&' operator. MonoDevelop.Ide GtkTreeModelResult.cs 125


public override AppResult
  Property(string propertyName, object value)
{
  if (resultIter != null && resultIter.HasValue) {
    var objectToCompare =
           TModel.GetValue (resultIter.Value, Column);
    return MatchProperty (propertyName, objectToCompare, value);
  }

  return MatchProperty (propertyName, ParentWidget, value);
}

TreeIter? resultIter;

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'resultIter != null' to the left and to the right of the '&&' operator. MonoDevelop.Ide GtkTreeModelResult.cs 135

MonoDevelop

V3001 There are identical sub-expressions 'member1.DeclaredAccessibility' to the left and to the right of the '!=' operator. CSharpBinding AbstractImplementInterfaceService.CodeAction.cs 544


Accessibility DeclaredAccessibility { get; }
bool IsStatic { get; }

private bool MembersMatch(ISymbol member1, ISymbol member2)
{
  if (member1.Kind != member2.Kind)
  {
    return false;
  }

  if (member1.DeclaredAccessibility !=
      member1.DeclaredAccessibility
   || member1.IsStatic != member1.IsStatic)
  {
    return false;
  }

  if (member1.ExplicitInterfaceImplementations().Any() ||
      member2.ExplicitInterfaceImplementations().Any())
  {
    return false;
  }

  return SignatureComparer
    .HaveSameSignatureAndConstraintsAndReturnTypeAndAccessors(
       member1, member2, this.IsCaseSensitive);
}

MonoDevelop

V3001 There are identical sub-expressions 'member1.IsStatic' to the left and to the right of the '!=' operator. CSharpBinding AbstractImplementInterfaceService.CodeAction.cs 545


Accessibility DeclaredAccessibility { get; }
bool IsStatic { get; }

private bool MembersMatch(ISymbol member1, ISymbol member2)
{
  if (member1.Kind != member2.Kind)
  {
    return false;
  }

  if (member1.DeclaredAccessibility !=
      member1.DeclaredAccessibility
   || member1.IsStatic != member1.IsStatic)
  {
    return false;
  }

  if (member1.ExplicitInterfaceImplementations().Any() ||
      member2.ExplicitInterfaceImplementations().Any())
  {
    return false;
  }

  return SignatureComparer
    .HaveSameSignatureAndConstraintsAndReturnTypeAndAccessors(
       member1, member2, this.IsCaseSensitive);
}

IronPython and IronRuby

V3001 There are identical sub-expressions 'litBegin.Value is int' to the left and to the right of the '&&' operator. IronRubyParseTreeOps.cs 277


private bool Enter(RangeExpression/*!*/ node, bool isCondition) {
  ....
  if (!isCondition && litBegin != null && litEnd != null
    && litBegin.Value is int && litBegin.Value is int) {
    _result = MakeNode(NodeKind.lit, new Range(
      (int)litBegin.Value, (int)litEnd.Value,
      node.IsExclusive));
  } else {
    ....
  }
  ....
}

IronPython and IronRuby

V3001 There are identical sub-expressions 'self is PythonDictionary' to the left and to the right of the '||' operator. IronPython ObjectOps.cs 452


private static PythonTuple ReduceProtocol2(
  CodeContext/*!*/ context, object self) {
  ....
  if (self is PythonDictionary || self is PythonDictionary) {
    dictIterator = PythonOps.Invoke(context, self,
      "iteritems", ArrayUtils.EmptyObjects);
  }
  ....
}

Samples by the Infragistics Company

V3001 There are identical sub-expressions 'double.IsNaN(Latitude)' to the left and to the right of the '||' operator. WeatherStation.cs 25


public bool IsValid
{
  get {
    var valid =
      double.IsNaN(Latitude) || double.IsNaN(Latitude) ||
      this.Weather.DateTime == Weather.DateTimeInitial;
    return valid;
  }
}

Samples by the Infragistics Company

V3001 There are identical sub-expressions 'xmax > rc.Right' to the left and to the right of the '&&' operator. Geometry. Geometry.CubicSpline.cs 529


private static int clipSegment(....)
{
  if (xmax > rc.Right && xmax > rc.Right)
  {
    return -1;
  }
}

Samples by the Infragistics Company

V3001 There are identical sub-expressions 'LineSpacingType == Infrastructure.LineSpacingTypes.Exactly' to the left and to the right of the '||' operator. ParagraphSettingsPreviewAdapter.cs 268


void ParagraphSettingsPreviewAdapter_PropertyChanged(
 object sender, PropertyChangedEventArgs e) {
  ....
  if (LineSpacingType == Infrastructure.LineSpacingTypes.Exactly
   || LineSpacingType == Infrastructure.LineSpacingTypes.Exactly)
  { .... }

Space Engineers

V3001 There are identical sub-expressions 'property.Name == "AxisScale"' to the left and to the right of the '||' operator. Sandbox.Graphics MyParticleEmitter.cs 352


void DeserializeV0(XmlReader reader)
{
  ....
  if (property.Name == "Rotation"  ||
      property.Name == "AxisScale" ||
      property.Name == "AxisScale")
    continue;
  ....
}

Xenko

V3001 There are identical sub-expressions 'SupportFormat(converting.Format)' to the left and to the right of the '&&' operator. SiliconStudio.TextureConverter DxtTexLib.cs 141


public bool CanHandleRequest(TexImage image, IRequest request)
{
  ....
  return SupportFormat(compress.Format) &&
           SupportFormat(image.Format);
  ....
  return SupportFormat(converting.Format) &&
           SupportFormat(converting.Format);      // <=
  ....
}

Xenko

V3001 There are identical sub-expressions 'rescale.Filter == Filter.Rescaling.Bicubic' to the left and to the right of the '||' operator. SiliconStudio.TextureConverter DxtTexLib.cs 148


public enum Rescaling
{
  Box = 0,
  Bicubic = 1,
  Bilinear = 2,
  BSpline = 3,
  CatmullRom = 4,
  Lanczos3 = 5,
  Nearest,
}

public bool CanHandleRequest(TexImage image, IRequest request)
{
  ....
  return rescale.Filter == Filter.Rescaling.Box      ||
           rescale.Filter == Filter.Rescaling.Bicubic ||  // <=
           rescale.Filter == Filter.Rescaling.Bicubic ||  // <=
           rescale.Filter == Filter.Rescaling.Nearest;
  ....
}

Xenko

V3001 There are identical sub-expressions 'box.Maximum.X - box.Minimum.X > sphere.Radius' to the left and to the right of the '&&' operator. SiliconStudio.Core.Mathematics Collision.cs 1322


public static ContainmentType BoxContainsSphere(
                                ref BoundingBox box,
                                ref BoundingSphere sphere)
{
  ....
  if ((((box.Minimum.X + sphere.Radius <= sphere.Center.X)    &&
        (sphere.Center.X <= box.Maximum.X - sphere.Radius))   &&
       ((box.Maximum.X - box.Minimum.X > sphere.Radius)      &&
       (box.Minimum.Y + sphere.Radius <= sphere.Center.Y)))  &&
      (((sphere.Center.Y <= box.Maximum.Y - sphere.Radius)   &&
        (box.Maximum.Y - box.Minimum.Y > sphere.Radius))    &&
      (((box.Minimum.Z + sphere.Radius <= sphere.Center.Z)    &&
      (sphere.Center.Z <= box.Maximum.Z - sphere.Radius))     &&
        (box.Maximum.X - box.Minimum.X > sphere.Radius))))
  ....
}

Xenko

V3001 There are identical sub-expressions 'item.Key == null' to the left and to the right of the '||' operator. SiliconStudio.Core MultiValueSortedDictionary.cs 318


public bool Remove(KeyValuePair<TKey, Tvalue> item)
{
  if (item.Key == null ||
      item.Key == null)
    throw new ArgumentException();
  ....
}

Xamarin.Forms

V3001 There are identical sub-expressions 'RwWait' to the left and to the right of the '|' operator. SplitOrderedList.cs 458


const int RwWait  = 1;
const int RwWrite = 2;
const int RwRead  = 4;
....

public void EnterReadLock()
{
  ....

  if ((Interlocked.Add(ref _rwlock, RwRead) &
      (RwWait | RwWait)) == 0)
    return;

  ....
}

Xamarin.Forms

V3001 There are identical sub-expressions 'Left == 0' to the left and to the right of the '&&' operator. Thickness.cs 29


public double Left   { get; set; }
public double Top    { get; set; }
public double Right  { get; set; }
public double Bottom { get; set; }

internal bool IsDefault
{
  get { return Left  == 0 && Top  == 0 &&
               Right == 0 && Left == 0; }
}

Accord.Net

V3001 There are identical sub-expressions 'image.PixelFormat != PixelFormat.Format32bppRgb' to the left and to the right of the '&&' operator. Accord.Imaging BlobCounterBase.cs 670


public Blob[] GetObjects(UnmanagedImage image,
                         bool extractInOriginalSize)
{
  ....
  if ((image.PixelFormat != PixelFormat.Format24bppRgb)    &&
      (image.PixelFormat != PixelFormat.Format8bppIndexed) &&
      (image.PixelFormat != PixelFormat.Format32bppRgb)    &&
      (image.PixelFormat != PixelFormat.Format32bppArgb)   &&
      (image.PixelFormat != PixelFormat.Format32bppRgb)    &&
      (image.PixelFormat != PixelFormat.Format32bppPArgb)
      )
  ....
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'image.PixelFormat != PixelFormat.Format32bppRgb' to the left and to the right of the '&&' operator. Accord.Imaging BlobCounterBase.cs 833

Mono

V3001 There are identical sub-expressions 'u.TypeArguments.Length' to the left and to the right of the '!=' operator. generic.cs 3135


public int ExactInference (TypeSpec u, TypeSpec v)
{
  ....
  var ac_u = (ArrayContainer) u;
  var ac_v = (ArrayContainer) v;
  ....
  var ga_u = u.TypeArguments;
  var ga_v = v.TypeArguments;
  ....
  if (u.TypeArguments.Length != u.TypeArguments.Length) // <=
    return 0;

  ....
}

Mono

V3001 There are identical sub-expressions 'j' to the left and to the right of the '-' operator. ecore.cs 4832


bool BetterFunction (....)
{
  ....
  int j = 0;
  ....
  if (!candidate_params &&
      !candidate_pd.FixedParameters [j - j]  // <=
                   .HasDefaultValue) {
    return true;
  }
  ....
  if (!candidate_pd.FixedParameters [j - 1].HasDefaultValue &&
       best_pd.FixedParameters [j - 1].HasDefaultValue)
    return true;

  if (candidate_pd.FixedParameters [j - 1].HasDefaultValue &&
      best_pd.HasParams)
    return true;
  ....
}

Mono

V3001 There are identical sub-expressions 'c != '<'' to the left and to the right of the '&&' operator. HttpListenerRequest.cs 99


internal void SetRequestLine (string req)
{
  ....
  if ((ic >= 'A' && ic <= 'Z') ||
      (ic > 32 && c < 127 && c != '(' && c != ')' && c != '<' &&
       c != '<' && c != '>'  && c != '@'  && c != ','         &&
       c != ';' && c != ':'  && c != '\\' && c != '"'         &&
       c != '/' && c != '['  && c != ']'  && c != '?'         &&
       c != '=' && c != '{'  && c != '}'))
    continue;
  ....
}

Mono

V3001 There are identical sub-expressions 'grid_style.LinkHoverColor' to the left and to the right of the '!=' operator. DataGrid.cs 2225


protected virtual bool ShouldSerializeLinkHoverColor ()
{
  return grid_style.LinkHoverColor != grid_style.LinkHoverColor;
}

Mono

V3001 There are identical sub-expressions 'value1.ClassName' to the left and to the right of the '==' operator. ThemeVisualStyles.cs 2141


static bool AreEqual (VisualStyleElement value1,
                      VisualStyleElement value2)
{
  return
    value1.ClassName == value1.ClassName && // <=
    value1.Part == value2.Part &&
    value1.State == value2.State;
}

GitExtensions

V3001 There are identical sub-expressions to the left and to the right of the '||' operator. GitUI FormRemotes.cs 192


private void ConfigureRemotes()
{
  ....
  if (!remoteHead.IsRemote ||
    localHead.IsRemote ||
    !string.IsNullOrEmpty(
      localHead.GetTrackingRemote(localConfig)) || // <=
    !string.IsNullOrEmpty(
      localHead.GetTrackingRemote(localConfig)) || // <=
    remoteHead.IsTag ||
    localHead.IsTag ||
    !remoteHead.Name.ToLower().Contains(
      localHead.Name.ToLower()) ||
    !remoteHead.Name.ToLower().Contains(
      _remote.ToLower()))
    continue;
  ....
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions '!curItem.IsSourceEqual(item.NeutralValue)' to the left and to the right of the '&&' operator. TranslationApp TranslationHelpers.cs 112

PowerShell

V3001 There are identical sub-expressions 'BaseMaximumVersion != null' to the left and to the right of the '&&' operator. System.Management.Automation ImportModuleCommand.cs 1663


internal Version BaseMinimumVersion { get; set; }
internal Version BaseMaximumVersion { get; set; }
protected override void ProcessRecord()
{
  if (BaseMaximumVersion != null &&
      BaseMaximumVersion != null &&
      BaseMaximumVersion < BaseMinimumVersion)
  {
    string message = StringUtil.Format(
      Modules.MinimumVersionAndMaximumVersionInvalidRange,
      BaseMinimumVersion,
      BaseMaximumVersion);
    throw new PSArgumentOutOfRangeException(message);
  }
  ....
}

PowerShell

V3001 There are identical sub-expressions to the left and to the right of the '&&' operator. System.Management.Automation serverremotesession.cs 633


internal static class RemoteDataNameStrings
{
  ....
  internal const string MinRunspaces = "MinRunspaces";
  internal const string MaxRunspaces = "MaxRunspaces";
  ....
}
internal void ExecuteConnect(....)
{
  ....
  if
  (
    connectRunspacePoolObject.Data
      .Properties[RemoteDataNameStrings.MinRunspaces] != null
    &&
    connectRunspacePoolObject.Data
      .Properties[RemoteDataNameStrings.MinRunspaces] != null
  )
  {
    try
    {
      clientRequestedMinRunspaces =
        RemotingDecoder.GetMinRunspaces(
          connectRunspacePoolObject.Data);
      clientRequestedMaxRunspaces =
        RemotingDecoder.GetMaxRunspaces(
          connectRunspacePoolObject.Data);
      clientRequestedRunspaceCount = true;
    }
    ....
  }
  ....
}

Media Portal 2

V3001 There are identical sub-expressions 'screenWidth != _screenSize.Width' to the left and to the right of the '||' operator. MainForm.cs 922


protected override void WndProc(ref Message m)
{
  int bitDepth = m.WParam.ToInt32();
  int screenWidth = m.LParam.ToInt32() & 0xFFFF;
  int screenHeight = m.LParam.ToInt32() >> 16;  // <=
  if (bitDepth != _screenBpp ||
      screenWidth != _screenSize.Width ||
      screenWidth != _screenSize.Width)         // <=
  {
    ....
  }

  ....
}

Instead of 'screenWidth' and '_screenSize.Width', we must use 'screenHeight' and '_screenSize.Height'.

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'p == null' to the left and to the right of the '||' operator. TriangulationConstraint.cs 141

PascalABC.NET

V3001 There are identical sub-expressions 'token.Kind == openBracketToken' to the left and to the right of the '||' operator. ICSharpCode.SharpDevelop NRefactoryInsightWindowHandler.cs 66


readonly int eofToken,
             commaToken,
             openParensToken,
             closeParensToken,
             openBracketToken,
             closeBracketToken,
             openBracesToken,
             closeBracesToken,
             statementEndToken;

public void InitializeOpenedInsightWindow(....)
{
  ....
  if (token.Kind == openParensToken ||
      token.Kind == openBracketToken ||
      token.Kind == openBracketToken) {  // <=
    bracketCount++;
  }
  ....
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'File.Exists(pdbFileName)' to the left and to the right of the '&&' operator. VisualPascalABCNET RunnerManagerHandlers.cs 165
  • V3001 There are identical sub-expressions '_pascal_set_constant.values != null' to the left and to the right of the '&&' operator. TreeConverter syntax_tree_visitor.cs 4553

PascalABC.NET

V3001 There are identical sub-expressions to the left and to the right of the '||' operator. NETGenerator.cs 461


public class CompilerOptions
{
  public enum PlatformTarget { x64, x86, AnyCPU,
    dotnet5win, dotnet5linux, dotnet5macos };
  ....
}
....
bool IsDotnet5()
{
  return
    comp_opt.platformtarget ==
      CompilerOptions.PlatformTarget.dotnet5win ||
    comp_opt.platformtarget ==
      CompilerOptions.PlatformTarget.dotnet5linux ||
    comp_opt.platformtarget ==
      CompilerOptions.PlatformTarget.dotnet5linux;  // <=
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'ctn2.compiled_type == TypeFactory.ObjectType' to the left and to the right of the '||' operator. NETGenerator.cs 8518

PascalABC.NET

V3001 There are identical sub-expressions 'SK == SymKind.field' to the left and to the right of the '||' operator. LightScopeHelperClasses.cs 30


public enum SymKind { var, field, param, procname, funcname,
                      classname, recordname, interfacename };
....
public class SymInfoSyntax
{
  public override string ToString()
  {
    ....
    if (SK == SymKind.var ||
        SK == SymKind.field ||
        SK == SymKind.field ||  // <=
        SK == SymKind.param)
    ....
  }
  ....
}

Unity C# reference source code

V3001 There are identical sub-expressions 'MethodAttributes.Public' to the left and to the right of the '|' operator. SyncListStructProcessor.cs 240


MethodReference GenerateSerialization()
{
  ....
  MethodDefinition serializeFunc = new
      MethodDefinition("SerializeItem", MethodAttributes.Public |
            MethodAttributes.Virtual |
            MethodAttributes.Public |  // <=
            MethodAttributes.HideBySig,
            Weaver.voidType);
  ....
}

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'MethodAttributes.Public' to the left and to the right of the '|' operator. SyncListStructProcessor.cs 309

Unity C# reference source code

V3001 There are identical sub-expressions 'format == RenderTextureFormat.ARGBFloat' to the left and to the right of the '||' operator. RenderTextureEditor.cs 87


public static bool IsHDRFormat(RenderTextureFormat format)
{
  Return (format == RenderTextureFormat.ARGBHalf ||
    format == RenderTextureFormat.RGB111110Float ||
    format == RenderTextureFormat.RGFloat ||
    format == RenderTextureFormat.ARGBFloat ||
    format == RenderTextureFormat.ARGBFloat ||
    format == RenderTextureFormat.RFloat ||
    format == RenderTextureFormat.RGHalf ||
    format == RenderTextureFormat.RHalf);
}

Infer.NET

V3001 There are identical sub-expressions 'double.IsInfinity(transition1.Weight.Value)' to the left and to the right of the '&&' operator. Runtime Automaton.Simplification.cs 479


private void MergeParallelTransitions()
{
  ....
  if (   transition1.DestinationStateIndex ==
         transition2.DestinationStateIndex
      &&
         transition1.Group ==
         transition2.Group)
  {
    if (transition1.IsEpsilon && transition2.IsEpsilon)
    {
      ....
    }
    else if (!transition1.IsEpsilon && !transition2.IsEpsilon)
    {
      ....
      if (double.IsInfinity(transition1.Weight.Value) &&
          double.IsInfinity(transition1.Weight.Value))
      {
        newElementDistribution.SetToSum(
          1.0, transition1.ElementDistribution,
          1.0, transition2.ElementDistribution);
      }
      else
      {
        newElementDistribution.SetToSum(
          transition1.Weight.Value, transition1.ElementDistribution,
          transition2.Weight.Value, transition2.ElementDistribution);
      }
  ....
}

Infer.NET

V3001 There are identical sub-expressions 'BindingFlags.Public' to the left and to the right of the '|' operator. Compiler CodeBuilder.cs 194


internal MethodBase ToMethodInternal(IMethodReference imr)
{
  ....
  bf |=   BindingFlags.Public
        | BindingFlags.NonPublic
        | BindingFlags.Public
        | BindingFlags.Instance;
  ....
}

AWS SDK for .NET

V3001 There are identical sub-expressions 'this.token == JsonToken.String' to the left and to the right of the '||' operator. AWSSDK.Core.Net45 JsonReader.cs 343


public bool Read()
{
  ....
  if (
    (this.token == JsonToken.ObjectEnd ||
    this.token == JsonToken.ArrayEnd ||
    this.token == JsonToken.String ||  // <=
    this.token == JsonToken.Boolean ||
    this.token == JsonToken.Double ||
    this.token == JsonToken.Int ||
    this.token == JsonToken.UInt ||
    this.token == JsonToken.Long ||
    this.token == JsonToken.ULong ||
    this.token == JsonToken.Null ||
    this.token == JsonToken.String  // <=
    ))
  {
    ....
  }
  ....
}

.NET Core Libraries (CoreFX)

V3001 There are identical sub-expressions 'CharType.Comment' to the left and to the right of the '|' operator. XmlUTF8TextReader.cs 56


private static byte[] s_charType = new byte[256]
{
  ....
  CharType.None|
  CharType.Comment|
  CharType.Comment|
  CharType.Whitespace|
  CharType.Text|
  CharType.SpecialWhitespace,
  ....
  CharType.None|
  CharType.Comment|
  CharType.Comment|
  CharType.Whitespace|
  CharType.Text|
  CharType.SpecialWhitespace,
  ....
  CharType.None|
  CharType.Comment|
  CharType.Comment|
  CharType.Whitespace,
  ....
};

Similar errors can be found in some other places:

  • V3001 There are identical sub-expressions 'CharType.Comment' to the left and to the right of the '|' operator. XmlUTF8TextReader.cs 58
  • V3001 There are identical sub-expressions 'CharType.Comment' to the left and to the right of the '|' operator. XmlUTF8TextReader.cs 64

Roslyn Analyzers

V3001 There are identical sub-expressions 'data1.IsReachableBlockData' to the left and to the right of the '==' operator. AnalysisEntityBasedPredicateAnalysisData.cs 39


protected AnalysisEntityBasedPredicateAnalysisData(....)
  : base(....)
{
  Debug.Assert(data1.IsReachableBlockData == data1.IsReachableBlockData);
  ....
}

Azure PowerShell

V3001 There are identical sub-expressions 'strTimespan.Contains("M")' to the left and to the right of the '||' operator. AzureServiceBusCmdletBase.cs 187


public static TimeSpan ParseTimespan(string strTimespan)
{
  ....
  if (strTimespan.Contains("P")
    || strTimespan.Contains("D")
    || strTimespan.Contains("T")
    || strTimespan.Contains("H")
    || strTimespan.Contains("M")
    || strTimespan.Contains("M"))
  ....
}

Azure PowerShell

V3001 There are identical sub-expressions 'this.AggregationType != null' to the left and to the right of the '&&' operator. GetAzureRmMetricCommand.cs 156


public AggregationType? AggregationType { get; set; }
....
protected override void ProcessRecordInternal()
{
  ....
  string aggregation = (this.AggregationType != null &&
    this.AggregationType.HasValue) ?
    this.AggregationType.Value.ToString() : null;
  ....
}

Telerik UI for UWP

V3001 There are identical sub-expressions 'newValue.HasValue' to the left and to the right of the '&&' operator. DateTimePicker.cs 576


private static void OnValueChanged(object sender,
                                   DependencyPropertyChangedEventArgs args)
{
  DateTimePicker picker = sender as DateTimePicker;

  var newValue = (DateTime?)args.NewValue;

  if (newValue.HasValue && newValue != null)      // <=
  {
    picker.utcValue = DateTime.SpecifyKind(newValue.Value,
                                           DateTimeKind.Utc);
  }
  else
  {
    picker.utcValue = DateTime.SpecifyKind(DateTime.Now,
                                           DateTimeKind.Utc);
  }
  ....
}

Azure SDK for .NET

V3001 There are identical sub-expressions 'buffer.Length' to the left and to the right of the '<' operator. AzureBaseBuffersExtensions.cs 30


public static async Task WriteAsync(...., ReadOnlyMemory<byte> buffer, ....)
{
  byte[]? array = null;
  ....
  if (array == null || buffer.Length < buffer.Length)
  {
    ....
  }
  ....
}

AvaloniaUI

V3001 There are identical sub-expressions 'controlledFlags' to the left and to the right of the '^' operator. WindowImpl.cs 975TwitterClientMessageHandler.cs 52


private void UpdateWMStyles(Action change)
{
  ....
  var style = (WindowStyles)GetWindowLong(....);
  ....
  style = style | controlledFlags ^ controlledFlags;
  ....
}

osu!

V3001 There are identical sub-expressions 'result == HitResult.Perfect' to the left and to the right of the '||' operator. DrawableHoldNote.cs 266


protected override void CheckForResult(....)
{
  ....
  ApplyResult(r =>
  {
    if (holdNote.hasBroken
      && (result == HitResult.Perfect || result == HitResult.Perfect))
      result = HitResult.Good;
    ....
  });
}

public enum HitResult
{
    None,
    Miss,
    Meh,
    Ok,
    Good,
    Great,
    Perfect,
}

osu!

V3001 There are identical sub-expressions 'family != GetFamilyString(TournamentTypeface.Aquatico)' to the left and to the right of the '&&' operator. TournamentFont.cs 64


public static string GetWeightString(string family, FontWeight weight)
{
  ....
  if (weight == FontWeight.Regular
    && family != GetFamilyString(TournamentTypeface.Aquatico)
    && family != GetFamilyString(TournamentTypeface.Aquatico))
    weightString = string.Empty;
  ....
}

Emby

V3001 There are identical sub-expressions 'c != '<'' to the left and to the right of the '&&' operator. HttpListenerRequest.Managed.cs 49


internal void SetRequestLine(string req)
{
  ....
  if ((ic >= 'A' && ic <= 'Z') ||
  (ic > 32 && c < 127 && c != '(' && c != ')' && c != '<' &&   // <=
  c != '<' && c != '>' && c != '@' && c != ',' && c != ';' &&  // <=
  c != ':' && c != '\\' && c != '"' && c != '/' && c != '[' &&
  c != ']' && c != '?' && c != '=' && c != '{' && c != '}'))
    continue;
  ....
}

RunUO

V3001 There are identical sub-expressions 'deed is SmallBrickHouseDeed' to the left and to the right of the '||' operator. RealEstateBroker.cs 132


public int ComputePriceFor( HouseDeed deed )
{
  int price = 0;

  if ( deed is SmallBrickHouseDeed ||    // <=
       deed is StonePlasterHouseDeed ||
       deed is FieldStoneHouseDeed ||
       deed is SmallBrickHouseDeed ||    // <=
       deed is WoodHouseDeed ||
       deed is WoodPlasterHouseDeed ||
       deed is ThatchedRoofCottageDeed )
      ....
}

Chocolatey

V3001 There are identical sub-expressions 'commandArguments.contains("-apikey")' to the left and to the right of the '||' operator. ArgumentsUtility.cs 42


public static bool arguments_contain_sensitive_information(string
 commandArguments)
{
  return commandArguments.contains("-install-arguments-sensitive")
  || commandArguments.contains("-package-parameters-sensitive")
  || commandArguments.contains("apikey ")
  || commandArguments.contains("config ")
  || commandArguments.contains("push ")
  || commandArguments.contains("-p ")
  || commandArguments.contains("-p=")
  || commandArguments.contains("-password")
  || commandArguments.contains("-cp ")
  || commandArguments.contains("-cp=")
  || commandArguments.contains("-certpassword")
  || commandArguments.contains("-k ")
  || commandArguments.contains("-k=")
  || commandArguments.contains("-key ")
  || commandArguments.contains("-key=")
  || commandArguments.contains("-apikey")
  || commandArguments.contains("-api-key")
  || commandArguments.contains("-apikey")
  || commandArguments.contains("-api-key");
}

Nethermind

V3001 There are identical sub-expressions 'a.s2 == b.s2' to the left and to the right of the '&&' operator. Nethermind.Dirichlet.Numerics UInt256.cs 1154


public static bool Equals(ref UInt256 a, ref UInt256 b)
{
  return a.s0 == b.s0 && a.s1 == b.s1 && a.s2 == b.s2 && a.s2 == b.s2;
}

ONLYOFFICE Community Server

V3001 There are identical sub-expressions 'searchFilterData.WithCalendar == WithCalendar' to the left and to the right of the '&&' operator. MailSearchFilterData.cs 131


public override bool Equals(object obj)
{
    var searchFilterData = obj as MailSearchFilterData;
    return searchFilterData != null &&
      searchFilterData.PrimaryFolder == PrimaryFolder &&
      searchFilterData.Unread == Unread &&
      searchFilterData.Attachments == Attachments &&
      searchFilterData.PeriodFrom == PeriodFrom &&
      searchFilterData.PeriodTo == PeriodTo &&
      searchFilterData.Important == Important &&
      searchFilterData.Sort == Sort &&
      searchFilterData.SortOrder == SortOrder &&
      searchFilterData.SearchText == SearchText &&
      searchFilterData.Page == Page &&
      searchFilterData.PageSize == PageSize &&
      searchFilterData.SetLabel == SetLabel &&
      searchFilterData.WithCalendar == WithCalendar &&  // <=
      searchFilterData.WithCalendar == WithCalendar &&  // <=
      searchFilterData.UserFolderId == UserFolderId &&
      searchFilterData.FromDate == FromDate &&
      searchFilterData.FromMessage == FromMessage &&
      searchFilterData.PrevFlag == PrevFlag;
}

EFCore

V3001 There are identical sub-expressions 'unaryExpression.NodeType == ExpressionType.Convert' to the left and to the right of the '||' operator. EFCore.Specification.Tests NorthwindStringIncludeQueryTestBase.cs 257


private static string GetPath(Expression expression)
{
  switch (expression)
  {
    ....
    case UnaryExpression unaryExpression
         when unaryExpression.NodeType == ExpressionType.Convert
           || unaryExpression.NodeType == ExpressionType.Convert
           || unaryExpression.NodeType == ExpressionType.TypeAs:

      return GetPath(unaryExpression.Operand);

    default:
      throw ....
  }
}

EFCore

V3001 There are identical sub-expressions 'sqlFunctionName == "max"' to the left and to the right of the '||' operator. EFCore.Sqlite.Core SqliteMathTranslator.cs 90


private static readonly Dictionary<MethodInfo, string> _supportedMethods = new()
{
  ....
  { typeof(Math).GetRequiredMethod(nameof(Math.Max), ...., "max" },
  { typeof(Math).GetRequiredMethod(nameof(Math.Min), ...., "min" },
  ....
};

public virtual SqlExpression? Translate(SqlExpression? instance, ....)
{
  if (_supportedMethods.TryGetValue(method, out var sqlFunctionName))
  {
    ....
    if (sqlFunctionName == "max" || sqlFunctionName == "max")
      ....
  }
  ....
}

LINQ to DB

V3001 There are identical sub-expressions 'genericDefinition == typeof(Tuple<,,,,,,,>)' to the left and to the right of the '||' operator. TypeExtensions.cs 230


public static bool IsTupleType(this Type type)
{
  ....
  if (genericDefinition    == typeof(Tuple<>)
        || genericDefinition == typeof(Tuple<,>)
        || genericDefinition == typeof(Tuple<,,>)
        || genericDefinition == typeof(Tuple<,,,>)
        || genericDefinition == typeof(Tuple<,,,,>)
        || genericDefinition == typeof(Tuple<,,,,,>)
        || genericDefinition == typeof(Tuple<,,,,,,>)
        || genericDefinition == typeof(Tuple<,,,,,,,>)
        || genericDefinition == typeof(Tuple<,,,,,,,>))
  {
    return true;
  }
  ....
}

DotNetNuke

V3001 There are identical sub-expressions '!info.Name.Equals("Templates_Files")' to the left and to the right of the '&&' operator. SettingsUtil.cs 1451


internal static IEnumerable<PropertyInfo> GetEditorConfigProperties()
{
  return
    typeof(EditorConfig).GetProperties()
      .Where(
        info => !info.Name.Equals("Magicline_KeystrokeNext")
             && !info.Name.Equals("Magicline_KeystrokePrevious")
             && !info.Name.Equals("Plugins")
             && !info.Name.Equals("Codemirror_Theme")
             && !info.Name.Equals("Width")
             && !info.Name.Equals("Height")
             && !info.Name.Equals("ContentsCss")
             && !info.Name.Equals("Templates_Files")
             && !info.Name.Equals("CustomConfig")
             && !info.Name.Equals("Skin")
             && !info.Name.Equals("Templates_Files")
             && !info.Name.Equals("Toolbar")
             && !info.Name.Equals("Language")
             && !info.Name.Equals("FileBrowserWindowWidth")
             && !info.Name.Equals("FileBrowserWindowHeight")
             && !info.Name.Equals("FileBrowserWindowWidth")
             && !info.Name.Equals("FileBrowserWindowHeight")
             && !info.Name.Equals("FileBrowserUploadUrl")
             && !info.Name.Equals("FileBrowserImageUploadUrl")
             && !info.Name.Equals("FilebrowserImageBrowseLinkUrl")
             && !info.Name.Equals("FileBrowserImageBrowseUrl")
             && !info.Name.Equals("FileBrowserFlashUploadUrl")
             && !info.Name.Equals("FileBrowserFlashBrowseUrl")
             && !info.Name.Equals("FileBrowserBrowseUrl")
             && !info.Name.Equals("DefaultLinkProtocol"));
}

eShopOnContainers

V3001 There are identical sub-expressions 'firstUrl.Host' to the left and to the right of the '==' operator. GrantUrlTesterService.cs 48


private bool CheckSameOrigin(string urlHook, string url)
{
  var firstUrl = new Uri(urlHook, UriKind.Absolute);
  var secondUrl = new Uri(url, UriKind.Absolute);

  return firstUrl.Scheme == secondUrl.Scheme &&
         firstUrl.Port == secondUrl.Port &&
         firstUrl.Host == firstUrl.Host;
}

Squidex

V3001 There are identical sub-expressions 'pw > 0' to the left and to the right of the '&&' operator. FileTagAssetMetadataSource.cs 80


public Task EnhanceAsync(UploadAssetCommand command)
{
  try
  {
    using (var file = Create(new FileAbstraction(command.File),
                                                 ReadStyle.Average))
    {
      ....
      var pw = file.Properties.PhotoWidth;
      var ph = file.Properties.PhotoHeight;

      if (pw > 0 && pw > 0)                        // <=
      {
        command.Metadata.SetPixelWidth(pw);
        command.Metadata.SetPixelHeight(ph);
      }
      ....
    }
    return Task.CompletedTask;
  }
  catch
  {
    return Task.CompletedTask;
  }
}

Barotrauma

V3001 There are identical sub-expressions 'string.IsNullOrEmpty(EndPoint)' to the left and to the right of the '||' operator. BanList.cs 41


public bool CompareTo(string endpointCompare)
{
  if (string.IsNullOrEmpty(EndPoint) || string.IsNullOrEmpty(EndPoint))
  { return false; }
  ....
}

AvalonStudio

V3001 There are identical sub-expressions 'c.Kind == NClang.CursorKind.FunctionDeclaration' to the left and to the right of the '||' operator. CPlusPlusLanguageService.cs 1275


private bool CursorIsValidDeclaration(ClangCursor c)
{
  var result = false;

  if (  (c.Kind == NClang.CursorKind.FunctionDeclaration)  // <=
      || c.Kind == NClang.CursorKind.CXXMethod
      || c.Kind == NClang.CursorKind.Constructor
      || c.Kind == NClang.CursorKind.Destructor
      || c.Kind == NClang.CursorKind.FunctionDeclaration)  // <=
  {
    result = true;
  }
  return result;
}

AvalonStudio

V3001 There are identical sub-expressions '_lastFrame.Width == 0' to the left and to the right of the '||' operator. RemoteWidget.cs 308


public override void Render(DrawingContext context)
{
  if (_lastFrame != null && !(   _lastFrame.Width == 0
                              || _lastFrame.Width == 0))
  {
    ....
  }
  base.Render(context);
}

Akka.NET

V3001 There are identical sub-expressions 's.SubscriptionTimeoutSettings == SubscriptionTimeoutSettings' to the left and to the right of the '&&' operator. ActorMaterializer.cs 620


public override bool Equals(object obj)
{
  if (!(obj is ActorMaterializerSettings s))
    return false;

  return
    s.InitialInputBufferSize == InitialInputBufferSize &&
    s.MaxInputBufferSize == MaxInputBufferSize &&
    s.Dispatcher == Dispatcher &&
    s.SupervisionDecider == SupervisionDecider &&
    s.SubscriptionTimeoutSettings == SubscriptionTimeoutSettings &&   // <=
    s.IsDebugLogging == IsDebugLogging &&
    s.OutputBurstLimit == OutputBurstLimit &&
    s.SyncProcessingLimit == SyncProcessingLimit &&
    s.IsFuzzingMode == IsFuzzingMode &&
    s.IsAutoFusing == IsAutoFusing &&
    s.SubscriptionTimeoutSettings == SubscriptionTimeoutSettings &&   // <=
    s.StreamRefSettings == StreamRefSettings;
}

.NET 7

V3001 There are identical sub-expressions 'underlying == MarshalerType.Single' to the left and to the right of the '||' operator. JSMarshalerType.cs 386


internal static void CheckNullable(JSMarshalerType underlyingSig)
{
  MarshalerType underlying = underlyingSig._signatureType.Type;
  if (underlying == MarshalerType.Boolean
      || underlying == MarshalerType.Byte
      || underlying == MarshalerType.Int16
      || underlying == MarshalerType.Int32
      || underlying == MarshalerType.BigInt64
      || underlying == MarshalerType.Int52
      || underlying == MarshalerType.IntPtr
      || underlying == MarshalerType.Double
      || underlying == MarshalerType.Single   // <=
      || underlying == MarshalerType.Single   // <=
      || underlying == MarshalerType.Char
      || underlying == MarshalerType.DateTime
      || underlying == MarshalerType.DateTimeOffset
      ) return;
  throw new ArgumentException("Bad nullable value type");
}

BTCPay Server

V3001 There are identical sub-expressions 'e.Name == InvoiceEvent.FailedToConfirm' to the left and to the right of the '||' operator. BTCPayServer\HostedServices\BitpayIPNSender.cs 264


public Task StartAsync(CancellationToken cancellationToken)
{
    ....
    if (invoice.FullNotifications)
    {
        if (e.Name == InvoiceEvent.Expired ||
           e.Name == InvoiceEvent.PaidInFull ||
           e.Name == InvoiceEvent.FailedToConfirm || // <=
           e.Name == InvoiceEvent.MarkedInvalid ||
           e.Name == InvoiceEvent.MarkedCompleted ||
           e.Name == InvoiceEvent.FailedToConfirm || // <=
           e.Name == InvoiceEvent.Completed ||
           e.Name == InvoiceEvent.ExpiredPaidPartial
         )
        {
            await Notify(invoice, e, false, sendMail);
            sendMail = false;
        }
    }

    if (e.Name == InvoiceEvent.Confirmed)
    {
        await Notify(invoice, e, false, sendMail);
        sendMail = false;
    }
    ....
}

public class InvoiceEvent : IHasInvoiceId
{
    public const string Created = "invoice_created";
    public const string ReceivedPayment = "invoice_receivedPayment";
    public const string PaymentSettled = "invoice_paymentSettled";
    public const string MarkedCompleted = "invoice_markedComplete";
    public const string MarkedInvalid = "invoice_markedInvalid";
    public const string Expired = "invoice_expired";
    public const string ExpiredPaidPartial = "invoice_expiredPaidPartial";
    public const string PaidInFull = "invoice_paidInFull";
    public const string PaidAfterExpiration = "invoice_paidAfterExpiration";
    public const string FailedToConfirm = "invoice_failedToConfirm";
    public const string Confirmed = "invoice_confirmed";
    public const string Completed = "invoice_completed";
    ....
}

MassTransit

V3001 There are identical sub-expressions '!context.ReceiveContext.IsDelivered' to the left and to the right of the '&&' operator. OutboxMessagePipe.cs 57


public async Task Send(OutboxConsumeContext<TMessage> context)
{
  ....

  if (   !context.ReceiveContext.IsDelivered       // <=
      && !context.ReceiveContext.IsDelivered)      // <=
  {
    await context.NotifyConsumed(context,
                                 timer.Elapsed,
                                 _options.ConsumerType)
                 .ConfigureAwait(false);
  }
  ....
}

Entity Framework Core

V3001 There are identical sub-expressions 'sqlFunctionName == "max"' to the left and to the right of the '||' operator. SqliteMathTranslator.cs 81


public virtual SqlExpression? Translate(....)
{
  if (SupportedMethods.TryGetValue(method, out var sqlFunctionName))
  {
    RelationalTypeMapping? typeMapping;
    List<SqlExpression>? newArguments = null;
    if (sqlFunctionName == "max" || sqlFunctionName == "max") // <=
    {
      typeMapping = ExpressionExtensions.InferTypeMapping(arguments[0],
                                                          arguments[1]);
      newArguments = new List<SqlExpression>
      {
        ....
      };
    }
    else
    {
      typeMapping = arguments[0].TypeMapping;
    }

    var finalArguments = newArguments ?? arguments;

    return _sqlExpressionFactory.Function(....);
  }

  return null;
}

.NET 8

V3001 There are identical sub-expressions 'tr.Namespace' to the left and to the right of the '==' operator. TypeReferenceExtensions.cs 365


public static bool IsTypeOf<T> (this TypeReference tr)
{
  var type = typeof (T);
  return tr.Name == type.Name && tr.Namespace == tr.Namespace;
}

.NET 8

V3001 There are identical sub-expressions 'context.Target.PointerSize == 4' to the left and to the right of the '&&' operator. MetadataFieldLayoutAlgorithm.cs 648


protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(....)
{
  bool requiresAlign8
    =    !largestAlignmentRequired.IsIndeterminate
      && context.Target.PointerSize == 4
      && context.Target.GetObjectAlignment(....).AsInt > 4
      && context.Target.PointerSize == 4;
}