Telerik.JustMock.Core.ElevatedMockingException issue

12 posts, 1 answers
  1. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 23 Jul 2015 Link to this post

    Hello guys!

     

    I get a Telerik.JustMock.Core.ElevatedMockingException when I run: Mock.Arrange(() => _client.GetAsync(Arg.IsAny<string>())).Returns(ShowMeTheMoney());

    static async Task<HttpResponseMessage> ShowMeTheMoney()
            {
                HttpRequestMessage httpRequest = new HttpRequestMessage();
                httpRequest.SetConfiguration(new HttpConfiguration());
                HttpResponseMessage response = httpRequest.CreateResponse(HttpStatusCode.OK, new List<SmsDTO>() { new SmsDTO()});
                return response;
            } 

        [TestMethod]
            public void GetAll_NullResultTes3t()
            {
                //Assert.IsTrue(Mock.IsProfilerEnabled);
                _client = Mock.Create<HttpClient>();
                _controller = new SmsController(new Persistence(_client));
                _controller.Request = new HttpRequestMessage();           
                Mock.Arrange(() => _client.GetAsync(Arg.IsAny<string>())).Returns(ShowMeTheMoney());
                IEnumerable<SmsDTO> actualResult = _controller.GetAll();
                CollectionAssert.AllItemsAreNotNull(actualResult.ToList());
            }

     

    I use VS2015 Enterprise and I have disabled IntelliTrace(Tools>Options>IntelliTrace: Uncheck the Enable IntelliTrace checkbox). Also I enabled the profiler from the JustMock Menu.

    I get the following in Event logs:
    Info: .NET Runtime version 4.0.30319.0 - The profiler has requested that the CLR instance not load the profiler into this process.  Profiler CLSID: '{9999995d-2cbb-4893-be09-fce80abc7564}'.  Process ID (decimal): 7808.  Message ID: [0x2516].

    Info: TraceLog Profiler component initialized successfully, process vstest.executionengine.x86.exe

    Info: .NET Runtime version 4.0.30319.0 - The profiler was loaded successfully.  Profiler CLSID: '{9999995d-2cbb-4893-be09-fce80abc7564}'.  Process ID (decimal): 7724.  Message ID: [0x2507].

    Error:

    The description for Event ID 0 from source Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event originated on another computer, the display information had to be saved with the event.

    The following information was included with the event: 

    Error Handler Exception: System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d). ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. (109, 0x6d).
       at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
       --- End of inner exception stack trace ---
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ConnectionStream.EndRead(IAsyncResult asyncResult)
       at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
       --- End of inner exception stack trace ---
       at System.Net.Security.NegotiateStream.EndRead(IAsyncResult asyncResult)
       at System.ServiceModel.Channels.StreamConnection.EndRead()
       --- End of inner exception stack trace ---
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext) \r\n    at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message& message)
       at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
       at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext& requestContext)

    the message resource is present but the message is not found in the string/message table

    Info: .NET Runtime version 4.0.30319.0 - The profiler has requested that the CLR instance not load the profiler into this process.  Profiler CLSID: '{b7abe522-a68f-44f2-925b-81e7488e9ec0}'.  Process ID (decimal): 6696.  Message ID: [0x2516].

     According to regedit, CLSID: '{9999995d-2cbb-4893-be09-fce80abc7564} corresponds to IntelliTrace and  CLSID: '{b7abe522-a68f-44f2-925b-81e7488e9ec0}' to CodeWeaverProfiler class. 

     Could you please help?

     

    Thanks!

  2. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 23 Jul 2015 Link to this post

    The full exception Message is:
    Cannot mock 'System.Threading.Tasks.Task`1[System.Net.Http.HttpResponseMessage] GetAsync(System.String)'. The profiler must be enabled to mock, arrange or execute the specified target.
    Detected active third-party profilers:
    * {9999995d-2cbb-4893-be09-fce80abc7564} (from process environment)
    Disable the profilers or link them from the JustMock configuration utility. Restart Visual Studio and/or the test runner after linking.

    StackTrace:

       at Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)
       at Telerik.JustMock.Core.MocksRepository.CheckMethodInterceptorAvailable(IMatcher instanceMatcher, MethodBase method)
       at Telerik.JustMock.Core.MocksRepository.AddArrange(IMethodMock methodMock)
       at Telerik.JustMock.Core.MocksRepository.Arrange[TMethodMock](Expression expr, Func`1 methodMockFactory)
       at Telerik.JustMock.Mock.<>c__DisplayClass8`1.<Arrange>b__6()
       at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction)
       at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)
       at SMSTemplate.Test.ControllerAndPersistenceTest.GetAll_NullResultTes3t() in D:\Work\CommunicationGateway\MicroServices\Templates\SMSTemplate\V1.1\SMSTemplate.Test\ControllerAndPersistenceTest.cs:line 35

     ​

  3. DevCraft R3 2016 release webinar banner
  4. Answer
    Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 24 Jul 2015 Link to this post

    Hello Ciprian,

    Open the JustMock configuration utility (JustMock->Options...) and click the "Visual Studio 2015 Code Coverage/IntelliTrace" check box. Restart Visual Studio and try running the test again.

    The IntelliTrace profiler is also loaded by Visual Studio's code coverage and by Fakes. Do you use any of those?

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 24 Jul 2015 in reply to Stefan Link to this post

    Hello Stefan!

     

    First let me just say that I don't get IntelliTrace 2015 in 'Telerik JustMock Configuration' window(that's what shows up when I click JustMock>Options).

     

    Your second advice worked. I found an unused reference to some fakes library in my test project(leftover from when I tried to write some tests with fakes). After I removed it, it just worked.

     

    Thanks! Problem solved!

     

    Ciprian.

  6. Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 27 Jul 2015 Link to this post

    Hello Ciprian,

    I'm glad that your issue is now resolved. It's strange that the configuration tool is not offering IntelliTrace 2015, as you have stated that the profiler is present in the COM registry. Can you send me a screenshot of what you see in the configuration tool, please?

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 27 Jul 2015 in reply to Stefan Link to this post

    Hello! I have attached the config tool window. Please let me know, if you need further details.
  8. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 30 Jul 2015 Link to this post

    Hi Ciprian,

    Thank you for the screen shots. We will investigate what could be causing this behavior locally and will address any issues found. It is possible that we require some further information from your side, so please let us know if this is okay to you?

    Regards,
    Kaloyan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  9. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 03 Aug 2015 in reply to Kaloyan Link to this post

    Sure.
  10. Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 11 Aug 2015 Link to this post

    Hello Ciprian,

    It appears that you're running an outdated version of JustMock that does not support the Visual Studio 2015 Code Coverage/IntelliTrace profiler integration. Can you update to the latest version of JustMock and try again? In any case, if you remove any Fakes assemblies from your test project and disable IntelliTrace from Visual Studio options, the JustMock profiler should load successfully and you will not need to link the profilers.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  11. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 12 Aug 2015 in reply to Stefan Link to this post

    I'm using Telerik JustMock 2014.3 1021(Oct. 27, 2014). I don't have access to a newer version. 

    Sorry.
  12. Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 12 Aug 2015 Link to this post

    Hi Ciprian,

    In that case remove any Fakes assemblies from your test project and disable IntelliTrace from Visual Studio options. The JustMock profiler should load successfully and you will not need to link the profilers.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  13. Ciprian
    Ciprian avatar
    7 posts
    Member since:
    May 2015

    Posted 12 Aug 2015 in reply to Stefan Link to this post

    Hello!

     I've already done that and it worked(see my second message).

     

    Thanks!

Back to Top
DevCraft R3 2016 release webinar banner