Archived

This forum has been archived. Please start a new discussion on GitHub.

IceSL 0.3.2: ArgumentException in IceConnection.cs

kwaclaw
kwaclaw Oshawa, Canada
This applies to Ice for Silverlight 0.3.2:
I ran into Ice.SocketExceptions triggered by an ArgumentException in MemoryStream.Read in readResponse(), file IceConnection.cs.

It seems the arguments passed to readResponse() are not correct
I found two places where this could happen:

line 645, line 672:
is__.resize(sz, true);
readResponse__(stream, buf, sz - IceInternal.Protocol.headerSize, ref position);


The problem is - IMO - that after is__.resize() is called, a new buffer could be allocated inside is__, and this new buffer needs to be extracted.

I fixed the code like this:
is__.resize(sz, true);
buf = is__.prepareRead();
readResponse__(stream, buf, sz - IceInternal.Protocol.headerSize, ref position);

and the exceptions don't happen anymore - so far ;)

Karl