[Mono-dev] BinaryReader does not reset decoder

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Sat Sep 19 12:42:15 EDT 2009


On Wed, 2009-09-09 at 16:31 +0200, Martin Dvořák wrote:
> Hi,
> While looking at the source code of System.IO.BinaryReader [1] I
> noticed it reuses char decoder and I'm just wondering whether it is ok
> that the BinaryReader does not reset its internal state before the
> loop in ReadString method. What if the code fails e.g. on line 498
> (sb.Append...) while the decoder contains fallback data. Next time
> ReadString is called, it will fail because decoder will try to use
> fallback data from previous call to ReadString. Or am I missing
> something here?

Yes. You're missing a test case ;-)

-Gonzalo




More information about the Mono-devel-list mailing list