diff --git a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs index 28bd2fa76..c63170bb5 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs @@ -5821,9 +5821,20 @@ internal static void Submit(WaitCallback callbak, object state) ThreadPool.QueueUserWorkItem( arg => { - callbak(state); - resetEvent.Set(); - events.TryRemove(eventGuid, out ManualResetEvent _); + try + { + callbak(state); + } + catch (Exception ex) + { + GXLogging.Error(log, "Error on submit of " + state.GetType(), ex); + throw; + } + finally + { + resetEvent.Set(); + events.TryRemove(eventGuid, out ManualResetEvent _); + } }); events[eventGuid]= resetEvent; diff --git a/dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs b/dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs index 4f0d4e5ee..6168de075 100644 --- a/dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs +++ b/dotnet/src/dotnetframework/GxClasses/Model/gxproc.cs @@ -91,7 +91,7 @@ protected void exitApplication() } private void exitApplication(bool flushBatchCursor) { - if (IsMain && !(context as GxContext).IsSubmited) + if (!(GxContext.IsHttpContext || GxContext.IsRestService) && IsMain && !(context as GxContext).IsSubmited) ThreadUtil.WaitForEnd(); if (flushBatchCursor)