From 34dfd1fbe2f1c655e8a017774febc044b7d8cb12 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 5 Mar 2024 15:59:44 +0100 Subject: [PATCH 1/4] Avoid closing server before client is closed. --- .../BlazorHostedApp/BlazorHosted.Server/ChatHub.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs index 39a97cc4a09ef..1e616653d54ad 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs @@ -13,9 +13,10 @@ public async Task SendMessage(string message, int sendingThreadId) await Clients.All.SendAsync("ReceiveMessage", changedMessage).ConfigureAwait(false); } - public void Exit(int code) + public async Task Exit(int code) { - Console.WriteLine($"Received exit code {code} from client."); + TestOutputWriteLine($"Received exit code {code} from client. Waiting 5 sec for the client to close and exiting the server"); + await Task.Delay(5000); Environment.Exit(code); } } From fa62f18bf685879f5d8cda408d04c5c1965fdc31 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 5 Mar 2024 16:07:18 +0100 Subject: [PATCH 2/4] Follow up for prev commit --- .../testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs index 1e616653d54ad..3f9fa2c9cda78 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs @@ -15,7 +15,7 @@ public async Task SendMessage(string message, int sendingThreadId) public async Task Exit(int code) { - TestOutputWriteLine($"Received exit code {code} from client. Waiting 5 sec for the client to close and exiting the server"); + Console.WriteLine($"Received exit code {code} from client. Waiting 5 sec for the client to close and exiting the server"); await Task.Delay(5000); Environment.Exit(code); } From bac9064193da792d0399e5c22199f9d5555ffd7f Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Tue, 5 Mar 2024 18:51:59 +0100 Subject: [PATCH 3/4] Exit client only. --- .../BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor | 3 --- .../BlazorHostedApp/BlazorHosted.Server/ChatHub.cs | 7 ------- 2 files changed, 10 deletions(-) diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index d8908fd4a9f99..635ef2d738eed 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -84,10 +84,7 @@ private async Task SendExitSignal() { - // exit the server - await _hubConnection.SendAsync("Exit", 0); await DisposeHubConnection(); - Helper.TestOutputWriteLine($"Exit signal was sent by CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); // exit the client await JSRuntime.InvokeVoidAsync("eval", "import('./dotnet.js').then(module => { module.dotnet; module.exit(0); });"); } diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs index 3f9fa2c9cda78..8b2e77807c6fb 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Server/ChatHub.cs @@ -12,11 +12,4 @@ public async Task SendMessage(string message, int sendingThreadId) string changedMessage = $"{message}-pong"; await Clients.All.SendAsync("ReceiveMessage", changedMessage).ConfigureAwait(false); } - - public async Task Exit(int code) - { - Console.WriteLine($"Received exit code {code} from client. Waiting 5 sec for the client to close and exiting the server"); - await Task.Delay(5000); - Environment.Exit(code); - } } From d6ae6bad2e1b82526a5abbce5c0c10d64caefd7a Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz Date: Wed, 6 Mar 2024 09:45:08 +0100 Subject: [PATCH 4/4] Remove blocking after merge. --- .../wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index 10ba63099d6be..b1e46d5110067 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -24,7 +24,6 @@ public SignalRClientTests(ITestOutputHelper output, SharedBuildPerTestClassFixtu } [ConditionalTheory(typeof(BuildTestBase), nameof(IsWorkloadWithMultiThreadingForDefaultFramework))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/99268", TestPlatforms.Windows)] [InlineData("Debug", "LongPolling")] [InlineData("Release", "LongPolling")] [InlineData("Debug", "WebSockets")]