Closed ArildF closed 7 years ago
The following code gives a StackOverflowException in Moq 4.2.1502.911, but not in 4.1.1309.1617:
public interface IFoo { IBar Bar { get; } } public interface IBar { IBar SomeOtherBar { get; } string ATC { get; } } [TestMethod] public void SomeTest() { var factory = new MockRepository(MockBehavior.Strict){DefaultValue = DefaultValue.Mock}; var foo = factory.Create<IFoo>(); foo.SetupGet(r => r.Bar.ATC).Returns("asjkhsd"); // boom }
This appears to be a similar problem to https://code.google.com/p/moq/issues/detail?id=332 , although in this case the result is a stack overflow and not an infinite loop as it appears in that issue.
Using DefaultValue.Empty avoids the problem; however, this may not be a practical solution in our case. The value of MockBehavior does not matter.
This appears to have been fixed. The error can no longer be reproduced in Moq 4.7.25.
The following code gives a StackOverflowException in Moq 4.2.1502.911, but not in 4.1.1309.1617:
This appears to be a similar problem to https://code.google.com/p/moq/issues/detail?id=332 , although in this case the result is a stack overflow and not an infinite loop as it appears in that issue.
Using DefaultValue.Empty avoids the problem; however, this may not be a practical solution in our case. The value of MockBehavior does not matter.