Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some NRT on StringCollection #106116

Merged
merged 2 commits into from
Sep 5, 2024

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.

Copy link

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
Copy link

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
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
82 of 84 checks passed
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
sirntar pushed a commit to sirntar/runtime that referenced this pull request Sep 30, 2024
@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