V3010. The return value of function 'Foo' is required to be utilized.
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());
}
....
}
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);
....
}
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 '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 '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 '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(); // <=
}
}
....
}
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;
}
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); // <=
}
....
}
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;
}
....
}
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.
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 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();
}
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();
}
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 );
}
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();
....
}
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);
}
....
}
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(" ", "");
....
}