Skip to content

Mention self-insertion UB in docs of CollectionExtensions.InsertRange #10388

Open
@karakasa

Description

@karakasa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.CollectionsuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions