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

No nullability annotation for StringValues #45819

Closed
onyxmaster opened this issue Dec 9, 2020 · 2 comments
Closed

No nullability annotation for StringValues #45819

onyxmaster opened this issue Dec 9, 2020 · 2 comments
Labels
area-Extensions-Primitives untriaged New issue has not been triaged by the area owner

Comments

@onyxmaster
Copy link

Currently, the StringValues string conversion operator (and StringValues.GetStringValue) are not nullable-annotated.

Since this implicit conversion can return null but is not annotated as such, it easily breaks code if you rely on nullability annotations. This is especially bad because the conversion is implicit and because of this, you can pass an empty StringValues to a method that expects a string, but null is passed instead, while the nullability analyzer stays silent.

I understand that not everything is null-annotated (especially former parts of ASP.NET Core), but we were bitten by this and the required change is probably minimal (although it might require other code to be annotated too).

@jeffschwMSFT jeffschwMSFT added untriaged New issue has not been triaged by the area owner area-Extensions-Primitives labels Dec 11, 2020
@ghost
Copy link

ghost commented Dec 11, 2020

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

Currently, the StringValues string conversion operator (and StringValues.GetStringValue) are not nullable-annotated.

Since this implicit conversion can return null but is not annotated as such, it easily breaks code if you rely on nullability annotations. This is especially bad because the conversion is implicit and because of this, you can pass an empty StringValues to a method that expects a string, but null is passed instead, while the nullability analyzer stays silent.

I understand that not everything is null-annotated (especially former parts of ASP.NET Core), but we were bitten by this and the required change is probably minimal (although it might require other code to be annotated too).

Author: onyxmaster
Assignees: -
Labels:

area-Extensions-Primitives, untriaged

Milestone: -

@eerhardt
Copy link
Member

Duplicate of #43605.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Primitives untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants