
Originally Posted by
kwaclaw
I am not sure how I can reliably reproduce it, but as far as I can tell, the ReadCallback in IceConnection.cs class instantiates a non-resizable stream which then throws this exception when the need for expansion arises.
Karl
The issues seeems to happen whenever ReadCallback.prepareWrite() enter the "else" branche of its main "if" statement.
The code there looks like:
Code:
int length = (int) (_stream.Length - _replySize);
Byte[] buff = new Byte[length];
_stream.Position = _replySize;
_stream.Read(buff, 0, length);
_stream = new MemoryStream(buff);
_replySize = 0;
_stream.Position = length;
This memorystream is not resizable. It can be made so by changing the code:
Code:
int length = (int) (_stream.Length - _replySize);
MemoryStream ms = new MemoryStream(length);
byte[] buff = ms.GetBuffer();
_stream.Position = _replySize;
_stream.Read(buff, 0, length);
ms.SetLength(length);
ms.Position = length;
_stream = ms;
_replySize = 0;
However, if this is the solution, it is not complete, as I now get an Ice.BadMagicException:
Error: Unhandled Error in Silverlight 2 Application Exception of type 'Ice.BadMagicException' was thrown. at Ice.ObjectPrxHelperBase.handleExceptionWrapper__(L ocalExceptionWrapper ex)
at KdSoftIce.Services.WhiteboardService.WhiteboardSes sionPrxHelper.AddPoints(Int32 clientId, StylusPoint[] points, Dictionary`2 context__, Boolean explicitContext__)
at KdSoftIce.Services.WhiteboardService.WhiteboardSes sionPrxHelper.AddPoints(Int32 clientId, StylusPoint[] points)
at WhiteBoardSL.Page.AddPointsTask.DoExecute()
Source File: http://localhost:4404/WhiteBoardSLTe...s-citxp-kwacla
Line: 0
Karl