Resharper: Possible null assignment to entity marked with notnull attribute

var reader = new StreamReader(response.GetResponseStream());

I suspect StreamReader constructor’s parameter has a notnull attribute. Try the following:

var stream = response.GetResponseStream();
if (stream == null)
  // throw an exception
var reader = new StreamReader(stream);

Leave a Comment

File not found.