Examples of errors detected by the V3029 diagnostic

V3029. The conditional expressions of the 'if' statements situated alongside each other are identical.


.NET Compiler Platform ("Roslyn")

V3029 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 223, 228. EditAndContinueTestHelpers.cs 223


internal void VerifySemantics(....)
{
  ....
  if (additionalOldSources != null)
  {
    oldTrees = oldTrees.Concat(
      additionalOldSources.Select(s => ParseText(s)));
  }

  if (additionalOldSources != null)
  {
    newTrees = newTrees.Concat(
      additionalNewSources.Select(s => ParseText(s)));
  }
  ....
}

Samples by the Infragistics Company

V3029 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 338, 339. Program.cs 42


public void OnPropertyChanged(PropertyChangedEventArgs ea) {
  ....
  var index = this.SelectedBrushCollectionIndex;
  ....
  if (index >= 0) {
    DebugManager.
      LogData(this.BrushCollectionList[index].ToText());
  }
  if (index >= 0) {
    this.SelectedBrushCollectionIndex = index;
  }
  ....
}

AWS SDK for .NET

V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 91, 95. AWSSDK.AppSync.Net45 CreateApiKeyResponseUnmarshaller.cs 91


public override AmazonServiceException UnmarshallException(....)
{
  ....
  if (errorResponse.Code != null &&
    errorResponse.Code.Equals("LimitExceededException"))
  {
    return new LimitExceededException(errorResponse.Message,
      innerException, errorResponse.Type, errorResponse.Code,
      errorResponse.RequestId, statusCode);
  }

  if (errorResponse.Code != null &&
    errorResponse.Code.Equals("LimitExceededException"))
  {
    return new LimitExceededException(errorResponse.Message,
      innerException, errorResponse.Type, errorResponse.Code,
      errorResponse.RequestId, statusCode);
  }
  ....
}

Similar errors can be found in some other places:

  • V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 75, 79. AWSSDK.CloudDirectory.Net45 CreateSchemaResponseUnmarshaller.cs 75
  • V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 105, 109. AWSSDK.CloudDirectory.Net45 GetSchemaAsJsonResponseUnmarshaller.cs 105
  • V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 201, 205. AWSSDK.CodeCommit.Net45 PostCommentForPullRequestResponseUnmarshaller.cs 201
  • And 7 additional diagnostic messages.

Emby

V3029 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 142, 152. LocalImageProvider.cs 142


private void PopulateImages(....)
{
  ....
  // Logo
  if (!isEpisode && !isSong && !isPerson)
  {
    added = AddImage(....);
    if (!added)
    {
      added = AddImage(....);
    }
  }
  // Art
  if (!isEpisode && !isSong && !isPerson)
  {
    AddImage(....);
  }
  ....
}


Bugs Found

Checked Projects
410
Collected Errors
14 111
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