-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions
Milestone
Description
The annotation we have is correct: it can be null. However, it'll never be null from the built-in handlers, yet developers are forced to either then do unnecessary null checks or !-away the nullable warnings, e.g.
using (var resp = await client.GetAsync(...))
{
string s = await resp.Content.ReadAsStringAsync(); // nullable warning; need to do `Content!` instead
}I wonder if we should change HttpResponseMessage.Content to be non-null returning and to lazily-initialize an empty content object if it would otherwise be null.
cc: @scalablecory, @davidsh, @safern, @buyaa-n
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionsProduct code improvement that does NOT require public API changes/additions