You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an type is registered to the test thread container (via TestThreadContext.TestThreadContainer), that implements IDisposable, and the container creates an instance (someone resolves it) it is expected that the Dispose method will be called latest before the test execution is finished.
But this will not happen, because Reqnroll does not dispose the test runners at the test-run end (TestRunnerManager.FireTestRunEndAsync).
Is it expected? The behaviour with IDisposable has always been a bit fuzzy, but the rules I understand is that if you create the object, you are responsible for its lifecycle and calling Dispose() when done. If the container creates the object, it should be responsible for its lifecycle. If the container was given an instance of the object, it should not dispose the object unless it was given an explicit instruction to take ownership of the lifecycle.
@Code-Grump Yes, thx for the clarification. I was not clear enough. The problem is that if the container creates the object (so you just have a type registration) the Dispose will not be called. I'll change the description to make this clear.
Reqnroll Version
1.0.1
Which test runner are you using?
MSTest
Test Runner Version Number
n/a
.NET Implementation
.NET 8.0
Test Execution Method
Visual Studio Test Explorer
Content of reqnroll.json configuration file
No response
Issue Description
If an type is registered to the test thread container (via
TestThreadContext.TestThreadContainer
), that implementsIDisposable
, and the container creates an instance (someone resolves it) it is expected that theDispose
method will be called latest before the test execution is finished.But this will not happen, because Reqnroll does not dispose the test runners at the test-run end (
TestRunnerManager.FireTestRunEndAsync
).Steps to Reproduce
See repo/workaround at https://github.com/reqnroll/Sample-ReqOverflow/blob/main/ReqOverflow.Specs.WebUI/Support/BrowserFactory.cs#L61
Link to Repro Project
https://github.com/reqnroll/Sample-ReqOverflow/blob/main/ReqOverflow.Specs.WebUI
The text was updated successfully, but these errors were encountered: