Примеры ошибок, обнаруженных с помощью диагностики V3014
V3014. It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'X'.
Microsoft Code Contracts
V3014 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'i'. SparseArray.cs 1956
override public string ToString()
{
StringBuilder str = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
if (data[i] != null)
{
for (int j = 0; j < lastElement[i]; i++) // <=
{
str.AppendFormat("({0},{1})", data[i][j].Index,
data[i][j].Value);
}
}
}
return str.ToString();
}
Similar errors can be found in some other places:
- V3014 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'k'. Writer.cs 3984
- V3014 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'count_d'. Octagons.cs 509
.NET Core Libraries (CoreFX)
V3014 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'i'. RegexCharClass.cs 1094
private void Canonicalize()
{
....
for (i = 1, j = 0; ; i++)
{
for (last = _rangelist[j]._last; ; i++)
{
if (i == _rangelist.Count || last == LastChar)
{
done = true;
break;
}
if ((CurrentRange = _rangelist[i])._first > last + 1)
break;
if (last < CurrentRange._last)
last = CurrentRange._last;
}
_rangelist[j] = new SingleRange(_rangelist[j]._first, last);
j++;
if (done)
break;
if (j < i)
_rangelist[j] = _rangelist[i];
}
_rangelist.RemoveRange(j, _rangelist.Count - j);
....
}
Entity Framework
V3014 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'i'. EFCore ExpressionEqualityComparer.cs 214
var memberInitExpression = (MemberInitExpression)obj;
....
for (var i = 0; i < memberInitExpression.Bindings.Count; i++)
{
var memberBinding = memberInitExpression.Bindings[i];
....
switch (memberBinding.BindingType)
{
case ....
case MemberBindingType.ListBinding:
var memberListBinding = (MemberListBinding)memberBinding;
for(var j=0;
i < memberListBinding.Initializers.Count; // <=
i++) // <=
{
hashCode += (hashCode * 397) ^
GetHashCode(memberListBinding.Initializers[j].Arguments);
}
break;
....
}
}