moq icon indicating copy to clipboard operation
moq copied to clipboard

4.7.137 regression

Open cbruun opened this issue 9 years ago • 9 comments

After upgrading to Moq 4.7.137 the following scenario breaks:

public void Main()
{
	new Mock<IBreak>().Object;
}

public interface IBreak
{
	void DoStuff<T>(Implementation1<T> a);
	void DoStuff<T>(Implementation2<T> a);
}

public abstract class BaseType<T>
{
}

public class Implementation1<T> : BaseType<T>
{
}

public class Implementation2<T> : BaseType<T>
{
}

cbruun avatar Oct 04 '17 09:10 cbruun

Thanks for reporting. This looks like a valid usage scenario, I can't see a reason why this shouldn't work.

It appears to be caused by some change inside Castle Core 4.2.0. I'll do some investigation and see what I can find.

stakx avatar Oct 04 '17 10:10 stakx

@cbruun, most of the work to get this fixed will have to happen over at castleproject/Core now.

In the meantime, if you could spare some time & would like to contribute to Moq, please feel free to submit a PR (against the develop branch) that adds your above repro code as a skipped unit test there, in UnitTests/Regressions/IssueReportsFixture.cs. For example:

#region 469

public class Issue469
{
    [Fact(Skip = "Temporarily disabled due to a regression in Castle Core, see https://github.com/castleproject/Core/issues/309.")]
    …
}

#endregion

P.S.: BaseType<T> isn't actually needed to reproduce the problem.

stakx avatar Oct 04 '17 15:10 stakx

@stakx, @cbruun and I worked on the issue together when he reported the regression, so I have taken the liberty to write the test and make the pull request.

I just now saw that you mention BaseType<T> isn't actually needed. Feel free to remove it from the PR.

AndersAppelt avatar Oct 05 '17 06:10 AndersAppelt

@ADThomsen, thanks for letting me know. Will merge your PR in a short while.

stakx avatar Oct 05 '17 06:10 stakx

This version along with Castle.Core 4.2.0 definitely breaks us. Will be stock with the previous version, i'll give it a try on the next release.

I was not able to pinpoint the issue, other than noticing test get hanged indefinitely.

ivancitin avatar Oct 05 '17 23:10 ivancitin

@ivancitin: Can you please post repro code of such a test that hangs as a separate issue? Could be a different problem than the one reported here.

stakx avatar Oct 06 '17 04:10 stakx

I'm preparing a "hotfix" version of Moq (4.7.x) which should be available in the next 24 hours or so.

stakx avatar Oct 10 '17 17:10 stakx

@cbruun and @ADThomsen: Moq 4.7.142 is now available. Once you update (which should automatically update its dependency Castle Core to 4.2.1, which is the important bit), you should be good.

stakx avatar Oct 10 '17 22:10 stakx

@stakx Thanks for the update. We have upgraded Moq and can confirm that our tests again work as expected.

AndersAppelt avatar Oct 11 '17 04:10 AndersAppelt