Replies: 1 comment
-
There are plenty of tests in the sample that don't have the same issue, since you didn't provide a single line of code I really have no idea. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm fighting with thread unsafe implementation of MassTransitHostedService and the code it calls on Dispose/StopAsync. This appears sometimes in NUnit tests with WebApplicationFactory.
I call WebApplicationFactory.Dispose() in test [TearDown] section, where I sometimes get the exception bellow.
I run the tests sequentially, in one thread. So there are never more tests, WebAppFactories or MT buses alive at same time.
Is it a bug that the Dispose code is not thread safe? I'm not sure how to handle this problem, I need to dispose the factory with each test to release resources.
I implemented IBusObserver to log where this is happening. I see the dispose is called from by code (
MzIntegrationTests
2.DisposeIntegrationTestResources()`), which I call in the TearDown section. But there sometimes apperas another place, which is also disposing the WebApplicationFactory DI container. See the attached stacks.First logged concurrent call detected in PreStop() (Called from my code, from TearDown):
Second logged concurrent call detected in PreStop() (Not called by me):
2 concurrent stopping calls detected!
Do you have any idea it is a bug? How to handle this correctly? Thanks for hints.
Beta Was this translation helpful? Give feedback.
All reactions