Code Coverage for 32 bit application is incomplete RRS feed

  • Question

  • Hi,

    I have a application build with VS 2005 and I'm using VS 2010 performance tools to collect code coverage information.  (I'm running on Win 7 x64)

    The following scenario work OK:

    - build the app as x64 in VS2005 with /PROFILER

    - instrument it with  VS 2010 "..Performance Tools\x64\vsinstr.exe"'

    - start monitor  "..\Performance Tools\x64\VSPerfMon.exe"'

    - run app

    - stop monitor

    Coverage data is generated completely for all code.

    The following scenario does NOT work:

    - build the app as x32 in VS2005 with /PROFILER

    - instrument it with  VS 2010 "..Performance Tools\vsinstr.exe"'

    - start monitor  "..\Performance Tools\VSPerfMon.exe"'

    - run app

    - stop monitor

    Coverage data is partially generated only for methods  that had at least one call to them. For methods that had no call no code coverage information is provided!

    • Edited by Dan OM Monday, November 19, 2012 7:24 AM
    Friday, November 16, 2012 1:37 PM

All replies

  • Hi Dan,

    Thank you for posting in the MSDN forum.

    If you build your app as “Any CPU”, could you get the code coverage for your app?

    In 64bit machine, I suggest you run the performance tool in X64 like this document.

    You would check whether the process is running as 32-bit. See “VSPERFON - Does not collect any code coverage , but the process was invoked” and “Web App not opening after instrumenting the dll via VSPERFMON”.

    Best Regards,

    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, November 20, 2012 9:53 AM
  • Hi Jack,

    - The project is a native C++ .exe and it doesn't have the "Any CPU" config. option.

    - The exe is .32 bit and the if the tools are 64-bit then it  won't generate any information so I need to use the 32-bit tools

    - the process is in fact running as  32-bit

    - The weird thing is that I receive code coverage only for called methods!

    Any other suggestions are more then welcomed, many thanks jack!

    Tuesday, November 20, 2012 1:59 PM
  • Hi Dan,

    Glad to receive your reply.

    Just to make this issue clearly, if you build you app as X64 in VS2005, and then collect the code coverage with x64 performance tool in VS2010, you could get all the code coverage for your code, but if you build you app with x32 in VS2005, and then use the “Performance Tools\VSPerfMon.exe”, the code coverage couldn’t be collected fully, am I right?

    If you create a simple VC++ app in VS2005, build with x32, and then try to collect the code coverage, what result do you get? Does it have the same issue? If you have the x32 machine, could you get the code coverage for all code?

    Not very sure about your app, if your target process ran as a service, please check Tim’s suggestion in this thread.

    In addition, you would make sure that your app could work normally when you build your app with x32 and x64. If the simple VC++ app worked well, just this specific app has this issue, and I doubt that it is related to your app. Maybe it has to load the 64 bit .dll files.

    If all projects have the same issue, could you share us a simple sample created in VS2005? I will try to collect the code coverage for it in my machine, if possible, please share us the detailed steps. Thanks for your understanding.  

    Best Regards,

    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 21, 2012 2:45 AM
  • Hi Jack,

    - Your understanding is right

    -  Also tried with a new project, the same happens. I think it's a 32-bit incompatibility bug in one of this three places: profiler(2005), vsinstr(2010), vsperfmon(2010).

    - I've tried collecting cove coverage on a 32-bit system, the same problem

    - The dummy new project is functional on both 32/64 bit versions

    Ok, here is the dummy project binaries build and profiled with VS2005:  https://skydrive.live.com/redir?resid=505B9E1EACA0AE0B!107

    This are the steps to follow:

    - Doesn't matter if the machine is 32 or 64 bit the coverage should be the same

    - Get VS Performance Tools 2010 Stand Alone package and install it

    - go to (the 32 bit) Perfomance Tools folder ( not Performance Tools\x64)

    - instrument the exe : vsintr -coverage [myassembly.exe]

    - start monitor: start vsperfmon -coverage -output:[mytestrun.coverage]

    - run .exe

    - stop monitor : vsperfcmd -shutdown

    - a .coverage file is created. ( that reflects incomplete coverage info)

    The exe contains the following class:

    class ClassTestCoverage{
    	int privatemember;
    	int FunctionClassTestCoverage1(int);
    	int FunctionClassTestCoverage2(int);
    	int FunctionClassTestCoverage3(int);
    	int FunctionClassTestCoverage4(int);

    And the Main is this:

    void main(void)
    	ClassTestCoverage testObject;

    As you can see , from all class methods only  'FunctionClassTestCoverage1' is shown  in coverage information. This is because it was the only method being called.

    If I use other class methods in main, the .coverage report will then have information about it.

    Hereis the 64bit version of the exe. If you perform all above steps using 64-bit performance tools, you will have complete code coverage.:


    Many thanks Jack for your help.



    Wednesday, November 21, 2012 7:34 AM
  • Hi Dan,

    Thank you for your question, we're doing research on this case, it might take some time before we get back to you. Thanks for your understanding.

    Have a nice day,


    It seems that I couldn’t run this .exe in my machine, so if possible, I suggest you share us your whole project, you could send it to jackzhai Hotmail dot com. I will try to check it. Thanks for your understanding. 

    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 22, 2012 6:50 AM
  • Hi Jack,

    Here is the link to the project: http://sdrv.ms/Qxa7uU

    Many thanks,


    Thursday, November 22, 2012 2:43 PM
  • Hi Dan,

    Sorry for that I couldn’t repro this issue, I just update this this app with VS2010, since I didn’t have the VS2005 Environment now. But if seems that I couldn’t get the code coverage.

    If you create a the same  project with VS2010, and build it with 32 bit and 64 bit, and then run the Perfomance Tools folder 32 bit and 64 bit, what result did you get? Could you get full code coverage with 64 bit performance tool?

    Based on my understanding, the code coverage result would be related to the class method which is called, I mean that if the class method doesn’t run, the code coverage would not include it. Of course, the code coverage is related to the IL language.

    Anyway, sorry for that I didn’t help you resolve this issue, but I will also try to create a new project with VS2010 and check it. If this issue is urgent, please contact support at http://support.microsoft.com. Thanks for your understanding.

    Have a nice weekend,

    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 23, 2012 9:31 AM
  • Hi Jack,

    The whole trick is in building the app with VS2005.

    I've built the dummy project with VS2010 and still the same, I get only partial coverage only for the method that was called.

    Thank you for your help Jack.

    Friday, November 23, 2012 9:46 AM
  • Hi Dan,

    Sorry for my delay.

    Could you share us the different code coverage results? Maybe we could find some useful information.


    Update: Since this thread is opened for a long time, to help you resolve this issue, you could open a new thread in this forum, I will try to involve someone familiar with this topic to further look at this issue. Would you mind creating a new thread for this issue? Thanks for your understanding

    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 26, 2012 3:10 AM
  • Hi Jack,

    the following archive http://sdrv.ms/V7BJm9  containes .coverage and .xml files for both 32 and 64 bit scenarios.

    As you will see, the 64bit coverage is complete and the 32 is partial.

    Hope some results will pop! :) Thanks

    Thursday, November 29, 2012 8:36 AM
  • Hi,

    We could open the code coverage with our VS, but it seems that we couldn’t see the result.

    If possible, you could check some settings in VS like this blog, I doubt that it didn’t include all of your code, and then Clean and Rebuild your project. Actually, we could create a test project for the app, and then get the code coverage for it like the blog provided by me. I ever created the test project for the VC# app, and we could get the code coverage like the following screen shot, since I’m not the expert for the VC++, if possible, you could try to check it, or you could create a simple C# app, check the result.

    If still no help, to help you resolve this issue as soon as possible, I’m afraid these questions require a more in-depth level of support.  

    As my previous reply, you could open a new thread, and you could post the link of this thread in your new thread, so it will make this issue clearly for other community members having similar questions, and I am trying to involve someone familiar with this topic to further look at this issue.

    If you could open a new thread, would you mind changing the issue type to General Discussion? So we would discuss this issue in the new thread. Thanks for your understanding.


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    Friday, November 30, 2012 7:00 AM