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
This issue started appearing when we upgraded to Moq 4.14.0. Prior Moq versions do not exhibit this behaviour. The associated unit testing library is xunit, in case that has any impact.
Moq: 4.14.0
xunit: 2.4.1
Visual Studio: 2019 16.5.3
A pattern that a set of our code is using is to verify a strict repository during test cleanup for ease of writing tests.
The relevant lines of code seem to be:
// mock Setup returns itself (i.e. real code would 'return this')
path.Setup(x => x.AddPathFragment("fragment")).Returns(path.Object);
Repository.VerifyAll();
Full reproduction code that fails is in this collapsed section:
Please let me know if any further details are needed. Hopefully we're not doing anything unexpected/silly!
Expected Outcome:
Code verifies as in Moq 4.13 & does not crash the test provider.
Actual Outcome:
---------- Starting test run ----------
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (32-bit Desktop .NET 4.0.30319.42000)
[xUnit.net 00:00:00.57] Starting: My.Mocking.Tests
The active test run was aborted.
Reason: Test host process crashed : Process is terminated due to StackOverflowException.
The exception is reported as entirely in native code, so unfortunately I cannot provide any meaningful callstack.
The text was updated successfully, but these errors were encountered:
hotchkj
changed the title
StackOverflowException when VerifyAll is called in test Dispose and mocked method returns itself
StackOverflowException on VerifyAll when mocked method returns mocked object
Apr 28, 2020
This issue started appearing when we upgraded to Moq
4.14.0
. Prior Moq versions do not exhibit this behaviour. The associated unit testing library is xunit, in case that has any impact.4.14.0
2.4.1
16.5.3
A pattern that a set of our code is using is to verify a strict repository during test cleanup for ease of writing tests.
The relevant lines of code seem to be:
Full reproduction code that fails is in this collapsed section:
Please let me know if any further details are needed. Hopefully we're not doing anything unexpected/silly!
Expected Outcome:
Code verifies as in Moq
4.13
& does not crash the test provider.Actual Outcome:
The exception is reported as entirely in native code, so unfortunately I cannot provide any meaningful callstack.
The text was updated successfully, but these errors were encountered: