[Mono-list] Re: XmlTextWriter bugs
Tue, 21 Jan 2003 12:46:49 -0800
if you check out the ECMA docs on StreamWriter, it states for Close:
This method calls System.IO.StreamWriter.Flush, writing buffered data to the
underlying stream. Following a call to System.IO.StreamWriter.Close, any
operations on the current instance might raise exceptions.
[Note: This version of System.IO.StreamWriter.Close is equivalent to
System.IO.StreamWriter.Dispose(true).This method overrides
and for Dispose(bool):
When the disposing parameter is true, this method releases all resources held
by any managed objects that this System.IO.StreamWriter references. This method
invokes the Dispose() method of each referenced object.
On Wed, 22 Jan 2003, email@example.com wrote:
> > Looks like there are bug in XmlTextWriter. It produces incorrect xml
> > (missing closing tags)
> Dietmar, as I said at irc, with my Windows environment, it result in no
> error. I also found there are similar test named
> TestConstructorsAndBaseStream at in XmlTextWriterTests.cs.
> Whether this is related or not, when I switched to Linux environment,
> Some errors occured related to StringWriter.ToString(). I assume some of
> them were because StringWriter.Close() disposes internalString (sets
> null) and then StringWriter.ToString() tries to use internalString,
> then NullPointerException occurs.
> (Both of the cases you provided are related to the *last* output line).
> On the other hand, then I read an article by MS about garbage collection,
> is was written that StreamWriter.Close() is designed to dispose its
> internals. If it is correct, then I cannot understand why I get no error
> on Windows... Does anyone have any hints around here?
> -- Atsushi Eno
> Mono-list maillist - Monofirstname.lastname@example.org