-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Invalid nullability annotation on HttpRequest.ContentType #32097
Comments
Thanks for contacting us. |
Good catch thanks! Interested in contributing a change for this? |
Thanks for the offer, but I'd be happy to give someone else the opportunity to take this. |
I'm interested in contributing. This would be my first non-doc contribution. If you and/or other reviewers don't mind helping me through the process, I'd be more than happy to do the "leg-work." Just let me know what needs to be done, and I can give it my best. I've read the contribution guidelines and code of conduct. Are you looking to just have the "?" added to the HttpRequest.ContentType to make the type nullable, and run a unit test for both type string and null? |
Yep! The trick with changing APIs is that we need to update the baseline files. You can read about that at https://github.com/dotnet/aspnetcore/blob/main/docs/APIBaselines.md#updated-apis. Essentially a Another thing with updating nullability on an API is that it can affect other code that might be using the changed API and didn't expect the property to ever be null. Fortunately the PR builds will find any of those, but building a couple projects locally can help find some of those quicker so there is less PR churn 😃
Don't think that's needed for this change, we're not changing any behavior or adding new code, but good thought 👍 |
Ok. Sounds good. I'll start taking a look into this. |
Thanks for the fix! Which release will include it? |
6.0-preview5. since this is an api change it's not something we can backport. |
After updating my Web API project from .NET Core 3.1 to .NET 5, I'm getting a warning along the lines of "variable is never null".
The warning is incorrect, because when I remove the null check, lots of my integration tests start to fail. Specifically, the ones where no Content-Type header is sent in the request.
This makes me believe the HttpRequest.ContentType property type should be
string?
instead ofstring
.The text was updated successfully, but these errors were encountered: