Test(new object[4], [1, 1, 1, 1]);
[MethodImpl(MethodImplOptions.NoInlining |
MethodImplOptions.NoOptimization)]
static int Test(object[] key, int[] fields)
{
int c = key != null ? key.Length : 0;
if (key is null || c <= 0 || fields.Length != c)
throw new ArgumentException();
int sum = 0;
for (int i = 0; i < key.Length; i++)
sum += fields[i];
return sum;
}
Debug: no exception
Release: ArgumentException was thrown.
.NET 11.0, win-x64
Debug: no exception
Release:
ArgumentException was thrown..NET 11.0, win-x64