From d26f6fde008c8336931b4a29577719646cad805d Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Wed, 19 Mar 2014 00:21:49 +0200 Subject: [PATCH] THRIFT-2339 Uncaught exception in thrift c# driver Patch: Janis Ser Github Pull Request: This closes #79 ---- commit d650ca3380aac39eae1f17dc72d4097eb3394562 Author: JSSTR Date: 2014-01-29T13:49:51Z Update TSocket.cs Make sure to catch all exceptions in the ConnectCallback. ---- --- lib/csharp/src/Transport/TSocket.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/csharp/src/Transport/TSocket.cs b/lib/csharp/src/Transport/TSocket.cs index 7717cfb7..35fbe975 100644 --- a/lib/csharp/src/Transport/TSocket.cs +++ b/lib/csharp/src/Transport/TSocket.cs @@ -177,16 +177,21 @@ namespace Thrift.Transport if( hlp.Client.Client != null) hlp.Client.EndConnect(asyncres); } - catch (SocketException) + catch (Exception) { // catch that away } if (hlp.DoCleanup) { - asyncres.AsyncWaitHandle.Close(); - if (hlp.Client is IDisposable) - ((IDisposable)hlp.Client).Dispose(); + try { + asyncres.AsyncWaitHandle.Close(); + } catch (Exception) {} + + try { + if (hlp.Client is IDisposable) + ((IDisposable)hlp.Client).Dispose(); + } catch (Exception) {} hlp.Client = null; } } -- 2.17.1