Skip to content

Commit 8094ff5

Browse files
onyxmastercraiggwilson
authored andcommitted
Suggested improvements (#4)
1 parent 80e8aba commit 8094ff5

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/MongoDB.Driver.Core/Core/Connections/BinaryConnection.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ internal class BinaryConnection : IConnection
5050
private readonly Dropbox _dropbox = new Dropbox();
5151
private DateTime _lastUsedAtUtc;
5252
private DateTime _openedAtUtc;
53-
private Exception _openException;
5453
private readonly object _openLock = new object();
5554
private Task _openTask;
5655
private readonly SemaphoreSlim _receiveLock;
@@ -220,6 +219,7 @@ public void Open(CancellationToken cancellationToken)
220219
_openedAtUtc = DateTime.UtcNow;
221220
taskCompletionSource = new TaskCompletionSource<bool>();
222221
_openTask = taskCompletionSource.Task;
222+
_openTask.IgnoreExceptions();
223223
connecting = true;
224224
}
225225
}
@@ -234,12 +234,6 @@ public void Open(CancellationToken cancellationToken)
234234
catch (Exception ex)
235235
{
236236
taskCompletionSource.TrySetException(ex);
237-
238-
// this line is here to ensure we treat this exception
239-
// as observed and prevent the TaskScheduler.UnobservedException
240-
// event from getting raised.
241-
_openException = taskCompletionSource.Task.Exception;
242-
243237
throw;
244238
}
245239
}

0 commit comments

Comments
 (0)