Mock.IsProfilerEnabled is false in Nant

2 posts, 0 answers
  1. Emmsa
    Emmsa avatar
    66 posts
    Member since:
    Oct 2006

    Posted 19 Oct 2012 Link to this post

    I have this target inside my build file

    <target name="Test" description="Test" depends="Build">
          <loadtasks assembly="C:\Program Files (x86)\Telerik\JustMock\Libraries\Telerik.JustMock.NAnt.dll" />
          <justmockstart />
              <formatter type="Xml" usefile="true" extension=".xml" outputdir="${build.dir}" />
              <test assemblyname="Tests/bin/release/Tests.dll" appconfig="Tests/bin/release/Tests.dll.config">
            <exclude name="FIXME" />
          <justmockstop />

    1. The "loadtasks" task works fine
    2. justmockstart says nothing
    3. I have a test with the following assert:

    Assert.IsTrue(Mock.IsProfilerEnabled, "Profile is enabled");

    And it fails, so Shouldn't the task "justmockstart" enable profiling in my tests?

  2. Kaloyan
    Kaloyan avatar
    880 posts

    Posted 23 Oct 2012 Link to this post

    Hi Dario,

     Thank you for contacting Telerik support.

     It is unfortunate to see that you are experiencing problems, integrating JustMock with Nant. However, to help you, we will need to investigate further in your issue.

     Here are several steps I would ask you to accomplish, so we can get the needed information:
    1. Go inside your code and into the test method you have:
      Assert.IsTrue(Mock.IsProfilerEnabled, "Profile is enabled");

      please add one of the following code blocks (it won`t be a problem if you add them both):
      Console.Error.WriteLine("ProcessID=" + System.Diagnostics.Process.GetCurrentProcess().Id);
      Console.Error.WriteLine("JUSTMOCK_INSTANCE=" + Environment.GetEnvironmentVariable("JUSTMOCK_INSTANCE"));
      Console.Error.WriteLine("COR_ENABLE_PROFILING=" + Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING"));
      Console.Error.WriteLine("COR_PROFILER=" + Environment.GetEnvironmentVariable("COR_PROFILER"));
      System.Diagnostics.Debug.WriteLine("ProcessID=" + System.Diagnostics.Process.GetCurrentProcess().Id);
      System.Diagnostics.Debug.WriteLine("JUSTMOCK_INSTANCE=" + Environment.GetEnvironmentVariable("JUSTMOCK_INSTANCE"));
      System.Diagnostics.Debug.WriteLine("COR_ENABLE_PROFILING=" + Environment.GetEnvironmentVariable("COR_ENABLE_PROFILING"));
      System.Diagnostics.Debug.WriteLine("COR_PROFILER=" + Environment.GetEnvironmentVariable("COR_PROFILER"));
    2. After you have done this, you will need to get some kind of monitoring tool, that can show you the debug output of your system. I would recommend you, using:
    3. Once you have started monitoring you will also need to start your project
    4. On the debug viewer check for:   ProcessID=...
    5. Open the Event Viewer and check if there is an event with "Event ID" = 1022. Take the ProcessID from the previous step and check if it`s connected with that event.

     I would ask you to send us the results of this procedure as follows:
    1. ProcessID=...
    2. The event viewer log, about event with ID = 1022.

     Thank you for your cooperation in advance.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top