Skip to content

Commit 1667f7a

Browse files
committed
fix: Don't rethrow in DiposeComponents directly
1 parent a517610 commit 1667f7a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/bunit/Rendering/BunitRenderer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ public Task DisposeComponents()
235235
});
236236

237237
rootComponents.Clear();
238-
AssertNoUnhandledExceptions();
239238
}
240239

241240
return returnTask;

tests/bunit.tests/BunitContextTest.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ public async Task Test102()
3030
callStack.Count.ShouldBe(2);
3131
}
3232

33-
[Fact(DisplayName = "DisposeComponents rethrows exceptions from Dispose methods in components")]
33+
[Fact(DisplayName = "DisposeComponents captures exceptions from Dispose in Renderer.UnhandledException")]
3434
public async Task Test103()
3535
{
3636
Render<ThrowExceptionComponent>();
37-
Func<Task> action = () => DisposeComponentsAsync();
37+
38+
await DisposeComponentsAsync();
3839

39-
await action.ShouldThrowAsync<NotSupportedException>();
40+
var actual = await Renderer.UnhandledException;
41+
actual.ShouldBeAssignableTo<NotSupportedException>();
4042
}
4143

4244
[Fact(DisplayName = "DisposeComponents disposes components nested in render fragments")]

0 commit comments

Comments
 (0)