Skip to content

Commit 1cc1c74

Browse files
committed
Capture exceptions when disposing the host that result on false failures
1 parent a44b26e commit 1cc1c74

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Components/test/E2ETest/Infrastructure/ServerFixtures/WebHostServerFixture.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ public override void Dispose()
3636

3737
private async ValueTask DisposeCore()
3838
{
39-
// This can be null if creating the webhost throws, we don't want to throw here and hide
40-
// the original exception.
41-
Host?.Dispose();
42-
await Host?.StopAsync();
39+
try
40+
{
41+
await Host?.StopAsync();
42+
// This can be null if creating the webhost throws, we don't want to throw here and hide
43+
// the original exception.
44+
Host?.Dispose();
45+
}
46+
catch
47+
{
48+
}
4349
}
4450
}

0 commit comments

Comments
 (0)