Description
Previously it was possible to set te content of a Patch, Post or Put request to null using the shorter helper functions on HttpClient. You can still do this using the null-forgiving operator (!), or by creating your own HttpRequestMessage and using SendAsync, since HttpRequestMessage.Content is marked as nullable.
So what I would like to do is:
public Task<HttpResponseMessage> Example(HttpClient http)
{
return http.PostAsync(new Uri("https://example.local/action-that-changes-state"), null);
}
With nullability analysis enabled, this currently gives the following compiler warning: warning CS8625: Cannot convert null literal to non-nullable reference type.
Configuration
.Net SDK version: 5.0.100
Regression?
This worked in previous .Net Core versions without warning, but only because System.Net.Http had not been annotated for nullability yet.
Description
Previously it was possible to set te content of a Patch, Post or Put request to null using the shorter helper functions on
HttpClient. You can still do this using the null-forgiving operator (!), or by creating your ownHttpRequestMessageand usingSendAsync, sinceHttpRequestMessage.Contentis marked as nullable.So what I would like to do is:
With nullability analysis enabled, this currently gives the following compiler warning:
warning CS8625: Cannot convert null literal to non-nullable reference type.Configuration
.Net SDK version: 5.0.100
Regression?
This worked in previous .Net Core versions without warning, but only because
System.Net.Httphad not been annotated for nullability yet.