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

4 posts, 1 answers
  1. Brian Pratt
    Brian Pratt avatar
    28 posts
    Member since:
    Apr 2010

    Posted 19 Feb 2013 Link to this post

    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
  2. Answer
    Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 20 Feb 2013 Link to this post

    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.
  3. DevCraft R3 2016 release webinar banner
  4. Brian Pratt
    Brian Pratt avatar
    28 posts
    Member since:
    Apr 2010

    Posted 21 Feb 2013 Link to this post

    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
  5. Brian Pratt
    Brian Pratt avatar
    28 posts
    Member since:
    Apr 2010

    Posted 27 Feb 2013 Link to this post

    Update:  Latest version did fix.

    Thanks,
    Brian
Back to Top