This is a migrated thread and some comments may be shown as answers.

Constructor with 11 parameters throws "JIT Compiler encountered an internal limitation."

3 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian Pratt
Top achievements
Rank 1
Brian Pratt asked on 19 Feb 2013, 03:17 PM
I have generated code, with this constructor:

internal Priority(Int32 priorityId, String name, Int32 rank, Int32 expirationBuffer, Boolean isLiveMicrophone, Boolean isEmergency, Boolean isRepeated, Int32 repeatBuffer, Single levelAdjustment, Boolean isInterruptible, Int32 percentAvailable)

When I mock the GetAll() method of the class (that calls the above constructor), it throws the "JIT Compiler encountered an internal limitation." error:

Mock.Arrange(() => Dvams.Priority.GetAll()).Returns(new Dvams.PriorityList());
var p = Dvams.Priority.GetAll();

JustMock version 2012.2.813.9.
If I modify the generated code to use only 8 parameters, it works fine. (I cant really modify the generated code in production)
Ran on another developers computer, same JustMock version, it works fine. (WHY?)

Any ideas as to how and/or why this is happening?  I would think JustMock would bypass the internals of GetAll(), ignoring the constructor, but it doesnt seem to be the case (at least on my computer).

Thanks,
Brian

3 Answers, 1 is accepted

Sort by
0
Accepted
Kaloyan
Telerik team
answered on 20 Feb 2013, 02:12 PM
Hello Brian Pratt,

It is unfortunate that you are experiencing issues with JustMock.

I tried reproducing the matter, and I must say that, I did not succeed. I wrote the following test and it behaved as expected:
public class Priority
{
    internal Priority(Int32 priorityId, String name, Int32 rank, Int32 expirationBuffer,
        Boolean isLiveMicrophone, Boolean isEmergency, Boolean isRepeated,
        Int32 repeatBuffer, Single levelAdjustment, Boolean isInterruptible, Int32 percentAvailable)
    {
    }
 
    public List<string> GetAll()
    {
        throw new NotImplementedException();
    }
}
 
    [TestMethod]
    public void ShouldTestIfMockingCtorIsThrowingException()
    {
        var mock = Mock.Create<Priority>();
        var expected = new List<string>();
 
        Mock.Arrange(() => mock.GetAll()).Returns(expected);
 
        var actual = mock.GetAll();
 
        Assert.AreEqual(expected, actual);
    }

To help you further, I would be needing the exact SUT and test method reproducing the issue itself.

Also, I am glad to announce that JustMock Q1 2013 will be released by the end of today. Feel free to try it.

Thank you for the patience and the collaboration in advance.

All the best,
Kaloyan
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Brian Pratt
Top achievements
Rank 1
answered on 21 Feb 2013, 01:42 PM
We are trying to update our licensing, so hopefully I'll be able to update my version soon.

What was strange was that it worked on another developers computer correctly, but not mine.

Anyway, if I get the update, I'll update this thread with the findings.

Thanks,
Brian
0
Brian Pratt
Top achievements
Rank 1
answered on 28 Feb 2013, 01:52 AM
Update:  Latest version did fix.

Thanks,
Brian
Tags
General Discussions
Asked by
Brian Pratt
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Brian Pratt
Top achievements
Rank 1
Share this question
or