Closed Bouke closed 4 years ago
By default StreamReader will close the stream it's reading from. This would close the request's input stream, which is not desired. Looking at StreamReader.Dispose it looks like closing the stream is the only thing it does. So it probably doesn't really matter that much, other than not disposing an IDisposable being a code smell.
At worst the StreamReader
object will live a little longer. Not worth using the (ugly) constructor that tells the StreamReader
it doesn't own the underlying Stream
.
https://github.com/aspnet/AspNetWebStack/blob/ebef5b7d821b64ed5c48765d0caf6ce8a9bcfaf5/src/System.Web.Mvc/JsonValueProviderFactory.cs#L51
The StreamReader isn't disposed, which I suppose should happen here?