We have some code that populates a stringbuilder from a MemoryStream, using a StreamReader's ReadToEnd() method. Platform is dot net 4.0 on Windows 7 machine, VS2010.
using (StreamReader reader =
At the "}" I can quickwatch the stream and it looks fine. I know the "using" causes dispose to be called on the streamreader at this point. Stepping past the "}", quickwatch on stream shows "threw an exception of type 'System.ObjectDisposedException'"
for the capacity, length and position properties of stream. This is all enclosed in a "using MemoryStream" block. Exiting the outer using block, I'll get an exception "Cannot access a closed stream." Does anyone know a workaround. If
there is a more appropriate forum to post this question please advise. Any help is greatly appreciated. Thank you.
View Complete Post