Skip to content

Commit 8065d64

Browse files
committed
Dispose test env in RequiredTransformations
Fixes a possible test-time crash introduced in f8330fd: there's no specified ordering for running the finalizer of _env, so sometimes it might run after another Dispose cleaned up the test environment, and then attempt to throw an assertion exception at a poorly-specified time, leading to a crash in the test process instead of a test failure.
1 parent 98e84cd commit 8065d64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Tasks.UnitTests/ResourceHandling/GenerateResource_Tests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.Build.UnitTests.GenerateResource_Tests.InProc
2020
{
2121
[Trait("Category", "mono-osx-failing")]
2222
[Trait("Category", "mono-windows-failing")]
23-
public sealed class RequiredTransformations
23+
public sealed class RequiredTransformations : IDisposable
2424
{
2525
private readonly TestEnvironment _env;
2626
private readonly ITestOutputHelper _output;
@@ -31,6 +31,11 @@ public RequiredTransformations(ITestOutputHelper output)
3131
_output = output;
3232
}
3333

34+
public void Dispose()
35+
{
36+
_env.Dispose();
37+
}
38+
3439
/// <summary>
3540
/// ResX to Resources, no references
3641
/// </summary>

0 commit comments

Comments
 (0)