-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Intermittent AccessViolationException in Mock<>.Object #860
Comments
Thanks for reporting. Hard to tell what's going on without repro code and information about the runtime / target framework used, could you provide some more detail? |
I am working on a repro. It is only occurring 5-10% of the time. I've attached a 2nd callstack as well. This is on .NET Framework 4.7.2. |
The original AV seems to be in the CodeCoverage engine. (3f64.48a8): Access violation - code c0000005 (first/second chance not available) Child-SP RetAddr Call Site00 0000001a |
There was just recently also an AccessViolationException in nunit (nunit/nunit#3295 (comment)) which they traced down to some bug in the coreclr. Maybe worth a look? |
@mayerj, any progress with the repro? Otherwise, I'll close this issue in a few days' time. (You can always post a repro after that and I'll reopen the issue, but in case this is no longer of any importance or concern to you, there's no point in keeping this open & letting it go stale.) |
Not a lot of luck getting a reliable repro. I've opened a support ticket with Microsoft support to look at the code coverage angle. |
@mayerj, I will close this issue to prevent it from going stale. Once you do have a repro (it doesn't have to be 100% reliable, I'm OK with running it a few times or a few copies of it in parallel), please post it here and we'll reopen! |
I know that has been closed for quite some time, but I wanted to circle back so it doesn't sit forever with no explanation. Microsoft confirmed that the code coverage engine used in vs2017/2019 had a bug that was causing incorrect code-gen. |
Just to follow up, the NUnit thread that @siprbaum linked had a reliable repro (after a lot of work): https:/jnm2/NUnitHangRepro. This was the original bug report: dotnet/runtime#10986. It was fixed in .NET Framework in February's update: https://devblogs.microsoft.com/dotnet/net-framework-february-2020-security-and-quality-rollup/.
|
@jnm2 thanks a lot for following up on this! Nice to see this did get fixed. |
stack.txt
We are seeing an intermittent (but locally reproducible) issue in our CI environment (TFS/vstest). It seems to happen roughly 10% of the time I run our CI tests.
It is an AccessViolationException inside the stack below. This callstack is visible from the diagnostic logs in vstest, but Moq seems to catch it and actually just returns null from Mock<>.Object.
While it is always a specific test that fails, there are many other tests that are running in parallel at the same time. I have not been able to get a smaller repro yet.
I don't know if this is a problem in Moq, Castle, or even .NET 4.7.2.
We are using Moq 4.12.0 (this also happened on 4.10.1, I upgraded to see if it fixed it).
Here is the callstack:
The text was updated successfully, but these errors were encountered: