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

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

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

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

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

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

Examples of errors detected by the V3010 diagnostic

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

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