Code inspection: Possible 'System.ArgumentOutOfRangeException'. Start index must be less than or equal to end index.
This inspection reports a constant range whose start is greater than its end when used with built-in range indexers such as arrays and strings. Such indexing can throw at runtime.
Example
var values = new[] { 10, 20, 30, 40, 50 };
var slice = values[4..2];
The start index is after the end index, so the range is invalid.
How to fix it
There is no dedicated quick-fix for this inspection. Rewrite the range so the start is not greater than the end.
var values = new[] { 10, 20, 30, 40, 50 };
var slice = values[2..4];
01 April 2026