Description
"foo".AsSpan(0, largeNumber)
will throw Specified argument was out of the range of valid values. (Parameter 'start')
.
Note the indicated parameter name. The issue here is the combination of start/length, and there's nothing you can change start
to to make this valid as the issue happens to be in the length argument.
We could consider removing the ExceptionArgument.start
, or use a different message that doesn't blame start
specifically.
runtime/src/libraries/System.Private.CoreLib/src/System/MemoryExtensions.cs
Lines 191 to 207 in 27604b5
We don't report the argument in Slice(int, int)
for example
runtime/src/libraries/System.Private.CoreLib/src/System/Span.cs
Lines 398 to 412 in 27604b5