Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6322901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:25:06+00:00 2026-05-24T16:25:06+00:00

For some reason OpenCover is not covering tests using moles on Windows Server 2003

  • 0

For some reason OpenCover is not covering tests using moles on Windows Server 2003 (64bit). I raised a similar question which solved it on my 32bit Windows 7 machine, but for some reason setting the Environment Variable on the Windows Server machine doesn’t make a difference.

CLRMONITOR_EXTERNAL_PROFILERS: 1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8

Is there a different CLSID for the x64 profiler? Or could this be another problem?

Steps to reproduce

Create a new project in visual studio with three methods:

public int method1()
{
    return 1;
}

public int method2()
{
    return 2;
}

public int method3()
{
    return 3;
}

Next create a test project like so:

[TestMethod()]
public void method1Test()
{
    // Test without moles
    Program target = new Program();
    int expected = 1;
    int actual = target.method1();
    Assert.AreEqual(expected, actual);
}

[TestMethod()]
[HostType("Moles")]
public void method2Test()
{
    // Test using moles
    ConsoleApplication2.Moles.MProgram.AllInstances.method2 = (instance) => { return 3; };
    Program target = new Program();

    // method3 is only called in this test
    int check = target.method3();
    int actual = target.method2();
    Assert.AreEqual(3, actual);
    Assert.AreEqual(3, check);
}

So that the above compiles, you will need to "Add a Moles Assembly" by right clicking on the ConsoleApplication2 reference and selecting "Add Moles Assembly".

Run OpenCover with the following command:

C:\Program Files\OpenCover>OpenCover.Console.exe 
-target:"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" 
-targetdir:"S:\Work\ConsoleApplication2"
-targetargs:"/testcontainer:\"TestProject1\bin\Debug\TestProject1.dll\""
-filter:"+[*]*"
-output:results.xml
-mergebyhash

The 64bit machine equivalent:

C:\Program Files (x86)\OpenCover>OpenCover.Console.exe" 
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"
-targetdir:"S:\Work\ConsoleApplication2"
-targetargs:"/testcontainer:\"TestProject1\bin\Debug\TestProject1.dll\""
-filter:"+[*]*"
-output:results.xml
-mergebyhash

Run ReportGenerator on the results.xml file.

Expected Results

If successful (as on my 32bit Windows 7 machine) the report should show method3 as covered (it is called in method2Test), and look like this:

Windows 7 32bit Report

However when run on the 64bit Windows Server, the results look like this:

Windows Server 64bit Report

In both cases all tests pass, but no coverage information is being picked up for the test using Moles on the 64bit Windows Server.

I hope this gives a more clear explanation of the problem – let me know if you need any more information.

Thanks, Jack

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:25:07+00:00Added an answer on May 24, 2026 at 4:25 pm

    I followed your instructions and I got your results when I used

    set CLRMONITOR_EXTERNAL_PROFILERS=1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8

    but I got required coverage results when I changed this to

    set CLRMONITOR_EXTERNAL_PROFILERS={1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}

    NOTE: used braces – which is the usual way of expressing a GUID

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason I never see this done. Is there a reason why not?
For some reason, when I try to install SQL Server 2008 Express , I
For some reason, Section 1 works but Section 2 does not. When run in
For some reason beyond me I can't access the mysql server on a machine.
For some reason the Windows command prompt is special in that you have to
For some reason the AppModel->updateAll() method does not escape data passed to it. Looking
For some reason the Joomla docs are not very friendly to people that don't
For some reason this is not working. Instead it thinks it should check the
For some reason, Firefox is throwing function not defined errors at this piece of
For some reason when I attempt to make a request to an Ajax.net web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.