Skip to content

Commit 188bf10

Browse files
committed
Fixed #113 ApplicationDispatcherUnhandledExceptionHandler was marking handled = true causing the process to keep alive.
@ejsmith We added a process queue statement as the queue could be processing in the background and won't be awaited for. I also moved processing queue check down to help prevent any race conditions.
1 parent 95c30d5 commit 188bf10

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/Exceptionless/Queue/DefaultEventQueue.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public Task ProcessAsync() {
4949
}
5050

5151
public void Process() {
52-
if (_processingQueue)
53-
return;
54-
5552
if (!_config.Enabled) {
5653
_log.Info(typeof(DefaultEventQueue), "Configuration is disabled. The queue will not be processed.");
5754
return;
5855
}
5956

60-
_log.Trace(typeof(DefaultEventQueue), "Processing queue...");
57+
if (_processingQueue)
58+
return;
59+
6160
_processingQueue = true;
6261

6362
try {
63+
_log.Trace(typeof(DefaultEventQueue), "Processing queue...");
6464
_storage.CleanupQueueFiles(_config.GetQueueName(), _config.QueueMaxAge, _config.QueueMaxAttempts);
6565
_storage.ReleaseStaleLocks(_config.GetQueueName());
6666

src/Platforms/Exceptionless.Windows/ExceptionlessWindowsExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static void Unregister(this ExceptionlessClient client) {
4646
client.SubmittingEvent -= OnSubmittingEvent;
4747

4848
client.ProcessQueue();
49+
4950
if (client.Configuration.SessionsEnabled)
5051
client.SubmitSessionEnd();
5152
}

src/Platforms/Exceptionless.Wpf/ExceptionlessClientExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public static void RegisterApplicationDispatcherUnhandledExceptionHandler(this E
5757
contextData.SetSubmissionMethod("DispatcherUnhandledException");
5858

5959
args.Exception.ToExceptionless(contextData, client).Submit();
60-
args.Handled = true;
60+
61+
// process queue immediately since the app is about to exit.
62+
client.ProcessQueue();
6163
};
6264

6365
try {

0 commit comments

Comments
 (0)