-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Include actual index in IndexOutOfRange message #27878
Copy link
Copy link
Closed
Labels
area-System.CollectionsenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
When testing, if you hit an IndexOutOfRangeException through out of bounds array access, it is sometimes helpful to know what the index was, to save firing up a debugger (if it will even repro).
In this context the exception is instantiated by the VM/JIT. I do not know whether this would affect performance.
System.IndexOutOfRangeException : Index was outside the bounds of the array.
Stack Trace:
at Microsoft.Collections.Extensions.DictionarySlim`2.Enumerator.MoveNext() in C:\git\corefxlab\src\Microsoft.Experimental.Collections\Microsoft\Collections\Extensions\DictionarySlim.cs:line 284
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at Microsoft.Collections.Extensions.Tests.DictionarySlimTests.EnumerateCheckEnding() in C:\git\corefxlab\tests\Microsoft.Experimental.Collections.Tests\DictionarySlimTests.cs:line 150
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.CollectionsenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions