diff --git a/src/NServiceBus.SqlServer/AdaptiveExecutor.cs b/src/NServiceBus.SqlServer/AdaptiveExecutor.cs index 45edc4b9e..1f68d3955 100644 --- a/src/NServiceBus.SqlServer/AdaptiveExecutor.cs +++ b/src/NServiceBus.SqlServer/AdaptiveExecutor.cs @@ -44,18 +44,18 @@ void StartTask() var taskId = Guid.NewGuid(); var receiveTask = Task.Factory .StartNew(ReceiveLoop, null, token, TaskCreationOptions.LongRunning, TaskScheduler.Default) - .ContinueWith(t => + .ContinueWith((t, s) => { - t.Exception.Handle(ex => + if (t.IsFaulted) { - HandleException(ex); - circuitBreaker.Failure(ex); - return true; - }); + t.Exception.Handle(ex => + { + HandleException(ex); + circuitBreaker.Failure(ex); + return true; + }); + } - }, token, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default) - .ContinueWith((_, s) => - { taskTracker.Forget((Guid)s); if (!taskTracker.ShouldStartAnotherTaskImmediately) diff --git a/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj b/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj index 1029f20cd..f0d713873 100644 --- a/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj +++ b/src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj @@ -15,7 +15,7 @@ $(SolutionDir)NServiceBus.snk ..\ - 3ead7d6a + 6113ccb8 true @@ -130,15 +130,15 @@ - + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + - \ No newline at end of file + diff --git a/src/NServiceBus.SqlServer/packages.config b/src/NServiceBus.SqlServer/packages.config index acae12b57..8da7c6068 100644 --- a/src/NServiceBus.SqlServer/packages.config +++ b/src/NServiceBus.SqlServer/packages.config @@ -1,6 +1,6 @@  - +