dotnet-api-docs icon indicating copy to clipboard operation
dotnet-api-docs copied to clipboard

Mention self-insertion UB in docs of `CollectionExtensions.InsertRange`

Open karakasa opened this issue 1 year ago • 1 comments

Describe the issue or suggestion

https://github.com/dotnet/runtime/blob/102f28e5a64cdbe89484ac10414fdebb9a51c65f/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/CollectionExtensions.cs#L140-L141

Per code, inserting a span from a List<T> into itself is UB. I think we should mention it in the docs, because List<T>.InsertRange(itself) does work but the Span version doesn't.

karakasa avatar Sep 11 '24 07:09 karakasa

Tagging subscribers to this area: @dotnet/area-system-collections