When would SqlCommand.ExecuteReader() return null?

It’s a false positive.

Reflecting on SqlDataReader.ExecuteReader, I can see that the only way the reader is returned as null is if the internal RunExecuteReader method is passed ‘false’ for returnStream, which it isn’t.

In the depths of SqlDataReader, a reader constructor is always called at some point, so I’m pretty sure this is not physically possible for ExecuteReader to return null.

Leave a Comment