diff --git a/src/Components/Ignitor/src/BlazorClient.cs b/src/Components/Ignitor/src/BlazorClient.cs index cddc48e094ea..46637eb3bbe6 100644 --- a/src/Components/Ignitor/src/BlazorClient.cs +++ b/src/Components/Ignitor/src/BlazorClient.cs @@ -348,7 +348,6 @@ public async Task ConnectAsync(Uri uri, bool connectAutomatically = true) }); _hubConnection = builder.Build(); - await HubConnection.StartAsync(CancellationToken); HubConnection.On("JS.AttachComponent", OnAttachComponent); HubConnection.On("JS.BeginInvokeJS", OnBeginInvokeJS); @@ -357,6 +356,8 @@ public async Task ConnectAsync(Uri uri, bool connectAutomatically = true) HubConnection.On("JS.Error", OnError); HubConnection.Closed += OnClosedAsync; + await HubConnection.StartAsync(CancellationToken); + if (!connectAutomatically) { return true; diff --git a/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj b/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj index 5ddf7c979045..78fc48dc825b 100644 --- a/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj +++ b/src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj @@ -57,4 +57,10 @@ + + + PreserveNewest + + + diff --git a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs index 707aad52b92b..52546042fb90 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/ComponentHubReliabilityTest.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Components.RenderTree; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.SignalR.Client; +using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.Logging; using TestServer; using Xunit; diff --git a/src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs index 60ec73621a96..c72eac1ff6eb 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/IgnitorTest.cs @@ -83,14 +83,14 @@ protected virtual Task InitializeAsync() return Task.CompletedTask; } - protected virtual Task DisposeAsync() + protected async virtual Task DisposeAsync() { if (TestSink != null) { TestSink.MessageLogged -= TestSink_MessageLogged; } - return Task.CompletedTask; + await Client.DisposeAsync(); } private void TestSink_MessageLogged(WriteContext context) diff --git a/src/Components/test/E2ETest/xunit.runner.json b/src/Components/test/E2ETest/xunit.runner.json new file mode 100644 index 000000000000..baa05fb93d2a --- /dev/null +++ b/src/Components/test/E2ETest/xunit.runner.json @@ -0,0 +1,7 @@ +{ + // This is set to -1 to allow the usage of an + // unlimited ammount of threads. + "maxParallelThreads": -1, + "diagnosticMessages": true, + "longRunningTestSeconds": 30 +}