Skip to content

Comments

Fix some NRT on StringCollection#106116

Merged
stephentoub merged 2 commits intodotnet:mainfrom
lilinus:fix-stringcollection-nrt
Sep 5, 2024
Merged

Fix some NRT on StringCollection#106116
stephentoub merged 2 commits intodotnet:mainfrom
lilinus:fix-stringcollection-nrt

Conversation

@lilinus
Copy link
Contributor

@lilinus lilinus commented Aug 8, 2024

StringCollection can contain null values. Fix annotations for AddRange and CopyTo to align with this.

@ghost
Copy link

ghost commented Aug 8, 2024

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
@ghost
Copy link

ghost commented Aug 8, 2024

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Aug 8, 2024
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-collections
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable based on the other APIs present in the collection. @stephentoub any objections?

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct and we should take it. Just note that it could introduce more warnings into a consumer.

@eiriktsarpalis
Copy link
Member

How so? It's only input parameters and none of the changed methods are virtual.

@stephentoub
Copy link
Member

How so? It's only input parameters and none of the changed methods are virtual.

I was thinking this would warn:
SharpLab. But it doesn't I believe for the same reason there's no compiler error with:
Base[] base = new Derived[1];
base[0] = new OtherDerived();
even though it'll fail at run-time.

@stephentoub
Copy link
Member

Thanks

@stephentoub stephentoub merged commit 66e45ef into dotnet:main Sep 5, 2024
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
sirntar pushed a commit to sirntar/runtime that referenced this pull request Sep 30, 2024
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Collections community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants