Примеры ошибок, обнаруженных с помощью диагностики V3029

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(....);
  }
  ....
}


Найденные ошибки

Проверено проектов
414
Собрано ошибок
14 218

А ты совершаешь ошибки в коде?

Проверь с помощью
PVS-Studio

Статический анализ
кода для C, C++, C#
и Java

goto PVS-Studio;
Этот сайт использует куки и другие технологии, чтобы предоставить вам более персонализированный опыт. Продолжая просмотр страниц нашего веб-сайта, вы принимаете условия использования этих файлов. Если вы не хотите, чтобы ваши данные обрабатывались, пожалуйста, покиньте данный сайт. Подробнее →
Принять