0 votes
by (190 points)

Hello,

I've run into the following issue: whenever I try to finalize an asynchronous send operation with TlsSocket.EndSend(), I get the following exception:


System.InvalidCastException: InvalidCastException
at Rebex.Net.TlsSocket.EndSend(IAsyncResult asyncResult)
at Infrastructure.Communication.SecureTcpClient.SendCallback(IAsyncResult result)
at tlqh.fehz(Object dqv)
at System.Threading.ThreadPool.WorkItem.doWork(Object o)
at System.Threading.Timer.ring()

The code that provokes it looks something like this:

// start asynchronous operation
socket.BeginSend(buffer, 0, buffer.Length, SocketFlags.None, SendCallback, socket);

// ... some lines skipped
private void SendCallback(IAsyncResult result)
{
    TlsSocket socket = (TlsSocket) result.AsyncState;

    socket.EndSend(result);

    //... further processing 
}

I'm using the latest 2018 R1 version of the library under .NET Compact Framework 3.5 on Windows CE.

Could you please help me to solve this issue?
Thanks in advance.

Applies to: Rebex TLS

1 Answer

0 votes
by (144k points)
selected by
 
Best answer

Hello,

It seems that TlsSocket.EndSend throws InvalidCastException when an error occurred during the asynchronous operation. This is caused by a bug in EndSend's error handling. We will fix this quickly and send you a link to a hotfix. Thanks for bringing this issue to our attention!

by (190 points)
Sounds good, thank you!
by (144k points)
I just sent a link to the hotfix to your e-mail address.
by (190 points)
Awesome, thanks a lot!
...