-
-
Notifications
You must be signed in to change notification settings - Fork 813
Deadlock in Interceptor #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don´t think so. The InvokeBase Interception strategy is still called under lock conditions and the lock is still made on "Mock". I believe executing the InvokeBase strategy under lock conditions is causing the deadlock. Unfortunately I do not have the time to verify that right now. Maybe I can can try to fix it on the weekend. |
I didn't have time to run test myself but doesn't seem related on the surface. |
weird thing is that there was no other change related to locking, so I /kzu Daniel Cazzulino On Thu, Apr 25, 2013 at 10:02 AM, Yonah Wahrhaftig <[email protected]
|
In my opinion this behavior was introduced when fixing issue #3. As far as I can tell (I´m still not so familiar with github) the lock was introduced to resolve the threading issue when calling methods on a mock from different threads in parallel. The lock is just covering to much. It is calling "foreign" code under lock conditions, what always is dangerous. But on the other hand it could very well be that I´m missing something here and I´m completely wrong .... that happens from time to time :) |
@FelicePollano did you have a chance to look at this? |
Full immersion until the end of the month. Felice Pollano http://www.felicepollano.comFrom: "Daniel Cazzulino" [email protected]
|
I thought I have a look at the code and try to fix it. Got the code from gitHub and build the whole thing (VS 2012). But somehow almost all UnitTest are failing with: System.TypeInitializationException Obviously I miss something here ... any hints? |
I've added pull request #68 that fixes this problem, i've used the code asmus attached as test for the fix. |
When calling Method1 on the mock, and Method one is executing Method2 asynchronously and then waiting for Method2 to complete Moq will cause a deadlock due to the interceptor implementation.
The actual method of the Mock will be called unter lock condition. This will cause a deadlock in some cases. Simple TestCase to reproduce the behavior:
The text was updated successfully, but these errors were encountered: