Мы используем куки, чтобы пользоваться сайтом было удобно.
Хорошо
to the top
close form

Заполните форму в два простых шага ниже:

Ваши контактные данные:

Шаг 1
Поздравляем! У вас есть промокод!

Тип желаемой лицензии:

Шаг 2
Team license
Enterprise license
** Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности
close form
Запросите информацию о ценах
Новая лицензия
Продление лицензии
--Выберите валюту--
USD
EUR
RUB
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Бесплатная лицензия PVS‑Studio для специалистов Microsoft MVP
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Для получения лицензии для вашего открытого
проекта заполните, пожалуйста, эту форму
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
Мне интересно попробовать плагин на:
* Нажимая на кнопку, вы даете согласие на обработку
своих персональных данных. См. Политику конфиденциальности

close form
check circle
Ваше сообщение отправлено.

Мы ответим вам на


Если вы так и не получили ответ, пожалуйста, проверьте, отфильтровано ли письмо в одну из следующих стандартных папок:

  • Промоакции
  • Оповещения
  • Спам

Вебинар: C# разработка и статический анализ: в чем практическая польза? - 18.11

>
>
>
Примеры ошибок, обнаруженных с помощью …

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

V3010. The return value of function 'Foo' is required to be utilized.


Umbraco

V3010 The return value of function 'ToArray' is required to be utilized. TemplateRepositoryTest.cs 570


public void Can_Get_Children_At_Root()
{
  ....
  using (var repository = CreateRepository(unitOfWork))
  {
    CreateHierarchy(repository, unitOfWork).ToArray();

    // Act
    var children = repository.GetChildren(-1);

    // Assert
    Assert.AreEqual(1, children.Count());
    Assert.AreEqual(1, children.DistinctBy(x => x.Id).Count());
  }
  ....
}

SharpDevelop

V3010 The return value of function 'Insert' is required to be utilized. InPlaceEditor.cs 166


....
public string Text { get; set; }
....
protected override void OnKeyUp(KeyEventArgs e)
{
  ....
  editor.Text.Insert(editor.CaretIndex, Environment.NewLine);
  ....
}

SharpDevelop

V3010 The return value of function 'Union' is required to be utilized. MappingBase.cs 274


public IEnumerable<PropertyMapping>
GetMappingForTable(SSDL.EntityType.EntityType table)
{
  var value = GetSpecificMappingForTable(table);
  var baseMapping = BaseMapping;
  if (baseMapping != null)
    value.Union(baseMapping.GetMappingForTable(table));
  return value;
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'OrderBy' is required to be utilized. CodeCoverageMethodElement.cs 124

Space Engineers

V3010 The return value of function 'Format' is required to be utilized. Sandbox.Game MyEntity3DSoundEmitter.cs 72


public void Init(string cueName)
{
  ....
  if (m_arcade.Hash    == MyStringHash.NullOrEmpty &&
      m_realistic.Hash == MyStringHash.NullOrEmpty)
    MySandboxGame.Log.WriteLine(string.Format(
      "Could not find any sound for '{0}'", cueName));
  else
  {
    if (m_arcade.IsNull)
      string.Format(                                       // <=
        "Could not find arcade sound for '{0}'", cueName);
    if (m_realistic.IsNull)
      string.Format(                                       // <=
        "Could not find realistic sound for '{0}'", cueName);
  }
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'Format' is required to be utilized. Sandbox.Game MyEntity3DSoundEmitter.cs 74

Old NASA World Wind (C#)

V3010 The return value of function 'Combine' is required to be utilized. ConfigurationLoader.cs 943


private static void addExtendedInformation(....)
{
 ....
 if(toolBarImage.Length > 0 &&
    !Path.IsPathRooted(toolBarImage))
      Path.Combine(...., toolBarImage);    // <=
 ....
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'Combine' is required to be utilized. ConfigurationLoader.cs 1361
  • V3010 The return value of function 'Combine' is required to be utilized. ConfigurationLoader.cs 1566
  • V3010 The return value of function 'Combine' is required to be utilized. ConfigurationLoader.cs 1687
  • And 1 additional diagnostic messages.

Mono

V3010 The return value of function 'ToString' is required to be utilized. ColumnTypeConverter.cs 91


public override object ConvertTo(.... object value,
                                 Type destinationType)
{
  ....
  if (destinationType == typeof(string)) {
    if (value == null) {
      return String.Empty;
    }
    else {
      value.ToString(); // <=
    }
  }
  ....
}

GitExtensions

V3010 The return value of function 'IsCardLayout' is required to be utilized. GitUI RevisionGrid.cs 2847


private void SetRevisionsLayout()
{
  IsCardLayout(); // <=
  ....
}

private bool IsCardLayout()
{
  return _layout == RevisionGridLayout.Card
   || _layout == RevisionGridLayout.CardWithGraph
   || _layout == RevisionGridLayout.LargeCard
   || _layout == RevisionGridLayout.LargeCardWithGraph;
}

PowerShell

V3010 The return value of function 'Concat' is required to be utilized. System.Management.Automation Parser.cs 4973


private CatchClauseAst CatchBlockRule(....
  ref List<TypeConstraintAst> errorAsts)
{
  ....
  if (errorAsts == null)
  {
    errorAsts = exceptionTypes;
  }
  else
  {
    errorAsts.Concat(exceptionTypes); // <=
  }
  ....
}

Orchard CMS

V3010 The return value of function 'Except' is required to be utilized. AdminController.cs 140


public ActionResult Preview(string themeId, string returnUrl) {
  ....
  if (_extensionManager.AvailableExtensions()
    ....
  } else {
    var alreadyEnabledFeatures = GetEnabledFeatures();
    ....
    alreadyEnabledFeatures.Except(new[] { themeId });
    TempData[AlreadyEnabledFeatures] = alreadyEnabledFeatures;
  }
  ....
}

Media Portal 2

V3010 The return value of function 'Contains' is required to be utilized. MovieFanArtHandler.cs 147


private SynchronizedCollection<Guid> _checkCache = ....;
private void ExtractFanArt(....)
{
  ....
  if (!MovieMetadataExtractor.SkipFanArtDownload)
    OnlineMatcherService.Instance.DownloadMovieFanArt(
      collectionMediaItemId.Value, collectionInfo, forceFanart);
    _checkCache.Contains(collectionMediaItemId.Value);     // <=
  ....
}

'Contains' function doesn't change '_checkCache' collection and return true if element contains in collection.


PascalABC.NET

V3010 The return value of function 'OrderBy' is required to be utilized. ICSharpCode.SharpDevelop RefactoringService.cs 86


static IEnumerable<ITreeNode<IClass>> FindDerivedClassesTree
(
  ....
)
{
  ....
  var result = new List<TreeNode<IClass>>();
  ....
  result.OrderBy(node => node.Content.FullyQualifiedName); // <=
  return result;
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'ToString' is required to be utilized. CodeCompletion SymTable.cs 2145

Unity C# reference source code

V3010 CWE-252 The return value of function 'Concat' is required to be utilized. AnimationRecording.cs 455


static public UndoPropertyModification[] Process(....)
{
  ....
  discardedModifications.Concat(discardedRotationModifications);
  return discardedModifications.ToArray();
}

OpenCvSharp

V3010 The return value of function 'ToString' is required to be utilized. ImgProcTest.cs 80


public static RectanglesIntersectTypes
RotatedRectangleIntersection(RotatedRect rect1,
                             RotatedRect rect2,
                             out Point2f[] intersectingRegion)
{
  using (var intersectingRegionVec = new VectorOfPoint2f())
  {
    int ret = NativeMethods
                .imgproc_rotatedRectangleIntersection_vector(
                         rect1, rect2, intersectingRegionVec.CvPtr);
    intersectingRegion = intersectingRegionVec.ToArray();
    return (RectanglesIntersectTypes) ret;
  }
}

public void RotatedRectangleIntersectionVector()
{
  var rr1 = new RotatedRect(new Point2f(100, 100),
                            new Size2f(100, 100),
                            45);
  var rr2 = new RotatedRect(new Point2f(130, 100),
                            new Size2f(100, 100),
                            0);

  Cv2.RotatedRectangleIntersection(rr1, rr2,
                out var intersectingRegion);

  ....

  intersectingRegion.ToString();
}

RunUO

V3010 The return value of function 'Intern' is required to be utilized. BasePaintedMask.cs 49


public static string Intern( string str )
{
  if ( str == null )
    return null;
  else if ( str.Length == 0 )
    return String.Empty;

  return String.Intern( str );
}

public BasePaintedMask( string staffer, int itemid )
                            : base( itemid + Utility.Random( 2 ) )
{
  m_Staffer = staffer;

  Utility.Intern( m_Staffer );
}

ONLYOFFICE Community Server

V3010 The return value of function 'Distinct' is required to be utilized. DbTenantService.cs 132


public IEnumerable<Tenant> GetTenants(string login, string passwordHash)
{
  //new password
  result = result.Concat(ExecList(q).ConvertAll(ToTenant)).ToList();
  result.Distinct();
  ....
}

ONLYOFFICE Community Server

V3010 The return value of function 'ToString' is required to be utilized. UserPhotoManager.cs 678


private static void ResizeImage(ResizeWorkerItem item)
{
  ....
  using (var stream2 = new MemoryStream(data))
  {
      item.DataStore.Save(fileName, stream2).ToString();

      AddToCache(item.UserId, item.Size, fileName);
  }
  ....
}

ONLYOFFICE Community Server

V3010 The return value of function 'Replace' is required to be utilized. TextFileUserImporter.cs 252


private int GetFieldsMapping(....)
{
  ....
  if (NameMapping != null && NameMapping.ContainsKey(propertyField))
  {
      propertyField = NameMapping[propertyField];
  }

  propertyField.Replace(" ", "");
  ....
}

PeachPie

V3010 The return value of function 'AddHours' is required to be utilized. DateTimeFunctions.cs 1232


using System_DateTime = System.DateTime;

internal static System_DateTime MakeDateTime(....) { .... }

public static long mktime(....)
{
  var zone = PhpTimeZone.GetCurrentTimeZone(ctx);
  var local = MakeDateTime(hour, minute, second, month, day, year);

  switch (daylightSaving)
  {
    case -1:
      if (zone.IsDaylightSavingTime(local))
        local.AddHours(-1);                   // <=
      break;
    case 0:
      break;
    case 1:
      local.AddHours(-1);                     // <=
      break;
    default:
      PhpException.ArgumentValueNotSupported("daylightSaving", daylightSaving);
      break;
  }
  return DateTimeUtils.UtcToUnixTimeStamp(TimeZoneInfo.ConvertTime(local,
                                                                   ....));
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'AddHours' is required to be utilized. DateTimeFunctions.cs 1239

PeachPie

V3010 The return value of function 'Insert' is required to be utilized. Filters.cs 150


public TextElement Filter(IEncodingProvider enc,
                          TextElement input,
                          bool closing)
{
  string str = input.AsText(enc.StringEncoding);

  if (pending)
  {
    if (str.Length == 0) str = "\r";
    else if (str[0] != '\n') str.Insert(0, "\r"); // <=
  }

  str = str.Replace("\r\n", "\n");
  if (str.Length != 0)
  {
    pending = str[str.Length - 1] == '\r';

    if (!closing && pending) str.Remove(str.Length - 1, 1); // <=
  }


  return new TextElement(str);
}

Similar errors can be found in some other places:

  • V3010 The return value of function 'Remove' is required to be utilized. Filters.cs 161

LINQ to DB

V3010 The return value of function 'ToDictionary' is required to be utilized. ReflectionExtensions.cs 34


public static MemberInfo[] GetPublicInstanceValueMembers(this Type type)
{
  if (type.IsAnonymous())
  {
    type.GetConstructors().Single()
                                    .GetParameters()
                                    .Select((p, i) => new { p.Name, i })
                                    .ToDictionary(_ => _.Name, _ => _.i);
  }
  ....
}

DotNetNuke

V3010 The return value of function 'Replace' is required to be utilized. CBO.cs 1038


private static string GetTableName(Type objType)
{
  string tableName = string.Empty;

  // If no attrubute then use Type Name
  if (string.IsNullOrEmpty(tableName))
  {
    tableName = objType.Name;
    if (tableName.EndsWith("Info"))
    {
      // Remove Info ending
      tableName.Replace("Info", string.Empty);
    }
  }
  ....
}

DotNetNuke

V3010 The return value of function 'Insert' is required to be utilized. PermissionController.cs 64


public static string BuildPermissions(IList Permissions, string PermissionKey)
{
  ....
  // get string
  string permissionsString = permissionsBuilder.ToString();

  // ensure leading delimiter
  if (!permissionsString.StartsWith(";"))
  {
    permissionsString.Insert(0, ";");
  }

  ....
}

DotNetNuke

V3010 The return value of function 'Replace' is required to be utilized. SkinInstaller.cs 230


public override void Install()
{
  ....
  skinFile.Replace(Globals.HostMapPath + "\\", "[G]");
  ....
}

BTCPay Server

V3010 The return value of function 'BadRequest' is required to be utilized. ChangellyController.cs 72


public async Task<IActionResult> CalculateAmount(....)
{
  try
  {
    ....
    while (true)
    {
      if (callCounter > 10)
      {
        BadRequest();                                         // <=
      }
      var computedAmount = await client.GetExchangeAmount(....);
      callCounter++;

      if (computedAmount < toCurrencyAmount)
      {
        ....
      }
      else
      {
        return Ok(currentAmount);
      }
    }
  }
  catch (Exception e)
  {
    return BadRequest(new BitpayErrorModel()
    {
      Error = e.Message
    });
  }
}

Eto.Forms

V3010 The return value of function 'Select' is required to be utilized. Eto PropertyDescriptorHelpers.cs 209


public static IEnumerable<IPropertyDescriptor> GetProperties(Type type)
{
  if (s_GetPropertiesMethod != null)
    ((ICollection)s_GetPropertiesMethod.Invoke(null, new object[] { type }))
                                       .OfType<object>()
                                       .Select(r => Get(r));  // <=
  return type.GetRuntimeProperties().Select(r => Get(r));
}

Barotrauma

V3010 The return value of function 'Trim' is required to be utilized. GameServer.cs 1589


private void ClientWriteInitial(Client c, IWriteMessage outmsg)
{
  ....

  if (gameStarted)
  {
    ....

    if (ownedSubmarineIndexes.Length > 0)
    {
      ownedSubmarineIndexes.Trim(';');
    }
    outmsg.Write(ownedSubmarineIndexes);
  }
}

Akka.NET

V3010 The return value of function 'Union' is required to be utilized. Akka.Cluster.Sharding EventSourcedRememberEntitiesCoordinatorStore.cs 123


protected override bool ReceiveRecover(object message)
{
  switch (message)
  {
    case ShardId shardId:
      _shards.Add(shardId);
      ....
    case SnapshotOffer offer when ....:
      _shards.UnionWith(state.Shards.Keys.Union(state.UnallocatedShards));
    case SnapshotOffer offer when ....:
      _shards.Union(state.Shards);      // <=
      ....
    case RecoveryCompleted _:
      ....
    case MigrationMarker _:
      _writtenMarker = true;
      return true;
  }
  ....
}

Discord.NET

V3010 The return value of function 'Concat' is required to be utilized. GuildHelper.cs 431


public static async Task<RestGuildUser> AddGuildUserAsync(....)
{
  ....
  if (args.Roles.IsSpecified)
  {
    var ids = args.Roles.Value.Select(r => r.Id);

    if (args.RoleIds.IsSpecified)
      args.RoleIds.Value.Concat(ids);                  // <=
    else
      args.RoleIds = Optional.Create(ids);
  }
  ....
}

MudBlazor

V3010 The return value of function 'Integrate' is required to be utilized. EndSlopeSpline.cs 26


public EndSlopeSpline(....):base(....)
{
  m = new Matrix(n);
  gauss = new MatrixSolver(n, m);
  a = new double[n];
  b = new double[n];
  c = new double[n];
  d = new double[n];
  h = new double[n];

  CalcParameters(firstSlopeDegrees, lastSlopeDegrees);
  Integrate();                                            // <=
  Interpolate();
}

MudBlazor

V3010 The return value of function 'Add' is required to be utilized. Filter.cs 140


internal void DateValueChanged(DateTime? value)
{
  _valueDate = value;

  if (value != null)
  {
    var date = value.Value.Date;

    // get the time component and add it to the date.
    if (_valueTime != null)
    {
      date.Add(_valueTime.Value);                    // <=
    }

    _filterDefinition.Value = date;
  }
  else
    _filterDefinition.Value = value;

  _dataGrid.GroupItems();
}

nopCommerce

V3010 The return value of function 'Distinct' is required to be utilized. OrderReportService.cs 342


public virtual async Task<....> GetOrderAverageReportLineAsync(....)
{
  ....

  if (!string.IsNullOrEmpty(orderNotes))
  {
    query = from o in query
            join n in _orderNoteRepository.Table on o.Id equals n.OrderId
            where n.Note.Contains(orderNotes)
            select o;

    query.Distinct();                          // <=
  }

  ....
}

DiIiS

V3010 The return value of function 'Concat' is required to be utilized. LooterBrain.cs 154


public class LooterBrain : Brain
{
  ....
  public override void Think(int tickCounter)
  {
    ....
    if (LootLegendaries)
      targets.Concat(....);
    ....
  }
  ....
}