P
piersh
here's the deal:
In .NET 1.1, the default implementation of Stream.BeginWrite (which
MemoryStream does not override) returns an IAsyncResult whose
'CompletedSynchronously' property returns 'True'.
However, it uses the asynchronous 'AsyncCallback.BeginInvoke' to invoke
the callback which probably won't have executed by the time the
BeginWrite call returns, and AFAICT there's no attempt to call, or
mechanism to let one call, the corresponding EndInvoke.
I was under the impression that 'CompletedSynchronously' implied that
the operation had completed and the callback (if any) had been called -
this is certainly the case for other types of streams.
It would seem to me that if a Stream.BeginXXXX method is going to
return 'CompletedSynchronously==true' it should either .Invoke the
callback synchronously, or, if it's invoking via .BeginInvoke, at least
call .EndInvoke either before returning, or in the corresponding
..EndXXXX method.
Or am I missing something here?
In .NET 1.1, the default implementation of Stream.BeginWrite (which
MemoryStream does not override) returns an IAsyncResult whose
'CompletedSynchronously' property returns 'True'.
However, it uses the asynchronous 'AsyncCallback.BeginInvoke' to invoke
the callback which probably won't have executed by the time the
BeginWrite call returns, and AFAICT there's no attempt to call, or
mechanism to let one call, the corresponding EndInvoke.
I was under the impression that 'CompletedSynchronously' implied that
the operation had completed and the callback (if any) had been called -
this is certainly the case for other types of streams.
It would seem to me that if a Stream.BeginXXXX method is going to
return 'CompletedSynchronously==true' it should either .Invoke the
callback synchronously, or, if it's invoking via .BeginInvoke, at least
call .EndInvoke either before returning, or in the corresponding
..EndXXXX method.
Or am I missing something here?