A bug when save to a stream

Topics: Project Management Forum
Apr 19, 2012 at 6:31 AM
The methods 
"public void Save(Stream outStream, Encoding encoding)"
and 
" public void Save(Stream outStream)"
 in class HtmlDocument,declare a StreamWriter for writing data to stream with default bufferSize.
But not with a flush or close method at end of wirte.So some data in buffer will be lost.
eg:
System.IO.MemoryStream ms = new MemoryStream();
 htmldoc.Save(ms, System.Text.Encoding.UTF8);		
 
Chang the method "public void Save(StreamWriter writer)" in HtmlDocument as following:
public void Save(StreamWriter writer)
        {
            Save((TextWriter)writer);
            writer.Flush();       //add Flush method to write buffer data to stream
        }