axodox / AxoCover

Nice and free .Net code coverage support for Visual Studio with OpenCover.
https://marketplace.visualstudio.com/items?itemName=axodox1.AxoCover
MIT License
248 stars 60 forks source link

Code coverage fails after upgrading to VS 15.7.5 #172

Open pablocar80 opened 6 years ago

pablocar80 commented 6 years ago

Hi, I updated VS to version 15.7.5 released a few days ago and AxoCover stopped being able to show the coverage. To solve this, I created a new testing project with only the following test:

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
        }
    }
}

I already uninstalled completely VS and installed it again. AxoCover worked for a while, and then stopped working again. Here is the detailed output:

Executing tests... | Runner version is 1.1.389.0. | We are on x86 platform. SerializableException: Could not load file or assembly 'AxoCover.Runner.XmlSerializers, Version=1.1.389.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) SerializableException: Could not load file or assembly 'AxoCover.Runner.XmlSerializers' or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) | File redirection is enabled for the following files: | C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll | C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll | C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll | C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.TestFramework.dll | C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll | Setting up file redirection hooks... | File redirection hooks are enabled.

Loading assembly from C:\Users\Pablo\AppData\Local\Microsoft\VisualStudio\15.0_6cc15c00\Extensions\ntrocxop.dn2\MSTestAdapter\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll... || Loaded executor: Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor << Assembly loaded. Running executor: Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor... || Processing tests in: C:\Users\Pablo\SkyDrive\Documents\Visual Studio 2017\Projects\UnitTestProject1\UnitTestProject1\bin\Debug\UnitTestProject1.dll... SerializableException: Element not found. (Exception from HRESULT: 0x80070490) SerializableException: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Deployment.AssemblyLoadWorker.GetTargetFrameworkVersionStringFromPath(String path) at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Deployment.AssemblyLoadWorker.GetTargetFrameworkVersionStringFromPath(String path) at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities.AppDomainUtilities.GetTargetFrameworkVersionString(String testSourcePath) Passed UnitTestProject1.UnitTest1.TestMethod1 << Executor finished. | File redirection rules are cleared. < Test execution finished. Shutting down... Exiting... Generating coverage report... SerializableException: The I/O operation has been aborted because of either a thread exit or an application request at System.ServiceModel.Channels.SocketConnection.HandleReceiveAsyncCompleted() Committing... No results, this could be for a number of reasons. The most common reasons are: 1) missing PDBs for the assemblies that match the filter please review the output file and refer to the Usage guide (Usage.rtf) about filters. 2) the profiler may not be registered correctly, please refer to the Usage guide and the -register switch. Test execution finished.

Eritey commented 6 years ago

We're getting the same error since we've updated our machines to the latest windows 10 updates. I'm guessing the issue is with OpenCover and not AxoCover but nothing has been reported on their Issues page yet.

axodox commented 6 years ago

I just updated to latest VS, tried AxoCover and it still worked. I restarted the machine, and reinstalled AxoCover but it still works as before. I am on latest windows 10 too.

I see some errors from 4 users in telemetry, saying "This program is blocked by group policy. For more information, contact your system administrator", however it seems to run the tests for you - at least without coverage, so that should not be the issue.

I will try with another machine tomorrow.

Eritey commented 6 years ago

Our tests still run successfully, its just the coverage that doesn't. Which is why I'm thinking its a problem with OpenCover and not AxoCover.

axodox commented 6 years ago

I was able to reproduce it on my other machine. You are right it is indeed OpenCover. The problem is that it's DLL registration does not work anymore - probably because of some change in Windows. Fortunately I have found a workaround for now:

Now your coverage will run again. I will check at the weekend to make this automatically in AxoCover, while OpenCover gets fixed. Or check if I can fix OpenCover myself.

markmercer10 commented 6 years ago

This worked for me

jbarradas commented 6 years ago

Also worked for us. Do not forget to try both x64 or x86 if the former doesn't work.

Chippychap commented 6 years ago

Registering by hand worked indeed. The issue itself appears to have something to do with per-user registration (on Windows 7), which I didn't know existed before, and not with Visual Studio itself.

The OpenCover command line tool also supports registering and unregistering using the administrator account using the -register:Path32 and -register:Path64 instead of -register:user.

userIsNikunj commented 5 years ago

Thanks It worked for me as well.

jgasiorowski commented 5 years ago

@axodox It is quite possible that in some cases #207 is the reason which should be fixed withing #208 PR + human intervention on his settings tab in AxoCover

idrisfl commented 4 years ago

Thanks! This saved me. I was struggling since morning with this.

ajt13a commented 4 years ago

This worked for me too! Thank you!

wesley-wws commented 3 years ago

this works for me! thanks!