BedrockFramework icon indicating copy to clipboard operation
BedrockFramework copied to clipboard

Unobserved task exception caught while calling ConnectAsync

Open robertmircea opened this issue 5 years ago • 1 comments

How should I handle this internal exception which is thrown by Client.ConnectAsync? I received this exception while trying to connect to a host which was temporarily down and connection timed out.

This is the entire stacktrace, nothing was removed. I have a handler for unobserved task exceptions which only logs the message (as below).

00:36:51.305 ERROR  [ThrId=02] Unobserved task exception caught in the main AppDomain. System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (60): Operation timed out [::ffff:172.16.x.y]:15019
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.<>c.<ConnectAsync>b__274_0(IAsyncResult iar)
--- End of stack trace from previous location where exception was thrown ---
   at Bedrock.Framework.SocketConnection.StartAsync()
   at Bedrock.Framework.Client.ConnectAsync(EndPoint endpoint, CancellationToken cancellationToken)

robertmircea avatar Jan 20 '20 22:01 robertmircea

There shouldn't be any unobserved tasks, it just sounds like a bug that needs to be fixed.

davidfowl avatar Jan 21 '20 01:01 davidfowl