From f9efec4e381c4bd71c52c8ac8fa32f87b96e883a Mon Sep 17 00:00:00 2001 From: jeffthiele-iq Date: Tue, 20 Mar 2018 08:15:51 -0500 Subject: [PATCH] Add dispose call when returning static content and on errors --- src/Nancy/NancyEngine.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Nancy/NancyEngine.cs b/src/Nancy/NancyEngine.cs index ba57d8df7d..abf51ff276 100644 --- a/src/Nancy/NancyEngine.cs +++ b/src/Nancy/NancyEngine.cs @@ -115,9 +115,16 @@ public Task HandleRequest(Request request, Func HandleRequest(Request request, Func { - tcs.SetException(errorTask.Exception); + try + { + tcs.SetException(errorTask.Exception); + } + finally + { + cts.Dispose(); + } }, true);