From a1106d4c40ad7a871db5db78d240518bb246bbdd Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 29 Dec 2025 17:34:56 +0100 Subject: [PATCH] Handle cancellation token disposal with error handling in ChatComponent --- .../Components/ChatComponent.razor.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs index 347c096b..3236d31e 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs +++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs @@ -933,10 +933,17 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable if (this.cancellationTokenSource is not null) { - if(!this.cancellationTokenSource.IsCancellationRequested) - await this.cancellationTokenSource.CancelAsync(); + try + { + if(!this.cancellationTokenSource.IsCancellationRequested) + await this.cancellationTokenSource.CancelAsync(); - this.cancellationTokenSource.Dispose(); + this.cancellationTokenSource.Dispose(); + } + catch + { + // ignored + } } }