Exceptions thrown when disposing a class fixture seems to be ignored by ncrunch:
Code:
using Xunit;
namespace Example;
public class Test : IClassFixture<Fixture>
{
[Fact]
public void Test1()
{
}
}
public class Fixture : IAsyncLifetime
{
public ValueTask DisposeAsync()
{
throw new Exception("Fail!");
}
public ValueTask InitializeAsync()
{
return ValueTask.CompletedTask;
}
}
This test (and the class fixture) will pass when running it with ncrunch.
Running the same test with Rider's test runner the test succeeds, but it fails for the class fixture, as expected:
Code:
Class cleanup failed
[img]null[/img]
Xunit.Sdk.TestPipelineException
Class fixture type 'Example.Fixture' threw in DisposeAsync
at Xunit.v3.FixtureMappingManager.<>c__DisplayClass13_0.<<DisposeAsync>b__0>d.MoveNext() in /_/src/xunit.v3.core/Utility/FixtureMappingManager.cs:line 82
--- End of stack trace from previous location ---
at Xunit.v3.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.v3.core/Exceptions/ExceptionAggregator.cs:line 124
at Xunit.v3.ExceptionAggregator.ThrowIfFaulted() in /_/src/xunit.v3.core/Exceptions/ExceptionAggregator.cs:line 167
at Xunit.v3.FixtureMappingManager.DisposeAsync() in /_/src/xunit.v3.core/Utility/FixtureMappingManager.cs:line 99
at Xunit.v3.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.v3.core/Exceptions/ExceptionAggregator.cs:line 124
NCrunch for Jetbrains Rider: v5.14.0.5
JetBrains Rider 2025.1.1, Build #RD-251.23774.471, built on April 28, 2025
.NET 9
<PackageReference Include="xunit.v3" Version="2.0.2" />