Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Code Coverage in VS 2012

I have a simple ASP.Net MVC 4 application with 3 simple tests.

Each of these tests run successfully to completion, however the Code Coverage window gives me the following error:

Empty results generated: No binaries were instrumented. Make sure the tests ran, required binaries were loaded, had matching symbol files, and were not excluded through custom settings. For more information see http://go.microsoft.com/fwlink/?LinkID=253731

I have done some research but nothing has resolved my problem to date.

  • I know the tests run
  • I have .pdb files in the same location as my .dll
  • I am not optimsing by code
  • I cannot find any .testsettings file
  • I Have also run my VS 2012 Ultimate as Administrator, but no luck.

If I find the .coverage file, all it has in it is:

PCHÿ

Not the xmls results or error message I am expecting.

like image 226
brettc4 Avatar asked May 12 '13 07:05

brettc4


People also ask

How do I enable code coverage in Visual Studio?

Starting in Visual Studio 2022 Update 2, you can enable faster code coverage test results by selecting Tools > Options > Environment > Preview Features, then selecting Code coverage experience improvements, and then restarting Visual Studio.

How do I check my Vscode coverage?

To see code coverage for your test, click the three-bars icon that's next to your Org alias at the bottom of VS Code and open the class or trigger that you're testing. Click the the three-bars icon to toggle between enabling and disabling code coverage highlighting.


1 Answers

I realise this is over a year old. Nevertheless I have just encountered exactly the same issue, even down to the "PCHÿ" text in the .coverage file and have found no solution up 'til now. But surely someone else has had the issue too so, just in case, here's the simple solution:

After checking this MSDN link and following its advice I still had the same issue. So, in the end, I shutdown VS, went to the root solution directory and deleted the .suo file. It has the hidden attribute set so you might need to set explorer to show hidden files.

Restart VS and re-run the code coverage tests. All fine.

like image 75
shunty Avatar answered Sep 21 '22 16:09

shunty