Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverlet in-process collector is not loaded for version > 1.0.0 #576

Closed
MarcoRossignoli opened this issue Sep 30, 2019 · 1 comment
Closed
Labels
bug Something isn't working driver-collectors Issue related to collectors driver tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly

Comments

@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Sep 30, 2019

During some debugging session for a user I found that if we update collector version > 1.0.0 the collector isn't loaded.
We can see the exception from logs:

"RunSettings": "<RunSettings>\r\n  <DataCollectionRunSettings>\r\n    <DataCollectors>\r\n      <DataCollector friendlyName=\"XPlat code coverage\" enabled=\"True\">\r\n        <Configuration>\r\n          <Format>cobertura</Format>\r\n        </Configuration>\r\n      </DataCollector>\r\n    </DataCollectors>\r\n  </DataCollectionRunSettings>\r\n  <RunSettingsDirectory />\r\n  <RunConfiguration>\r\n    <ResultsDirectory>C:\\git\\coverletissue\\coverletdemo-master\\CoverletDemo.Test\\TestResults</ResultsDirectory>\r\n    <TargetPlatform>X86</TargetPlatform>\r\n    <TargetFrameworkVersion>.NETCoreApp,Version=v2.2</TargetFrameworkVersion>\r\n    <TestAdaptersPaths>C:\\Users\\Marco\\.nuget\\packages\\coverlet.collector\\1.1.0\\build\\netstandard1.0\\;C:\\Users\\Marco\\.nuget\\packages\\microsoft.codecoverage\\16.3.0\\build\\netstandard1.0\\</TestAdaptersPaths>\r\n    <DesignMode>False</DesignMode>\r\n    <CollectSourceInformation>False</CollectSourceInformation>\r\n  </RunConfiguration>\r\n  <InProcDataCollectionRunSettings>\r\n    <InProcDataCollectors>\r\n      <InProcDataCollector assemblyQualifiedName=\"Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\" friendlyName=\"XPlat Code Coverage\" enabled=\"True\" codebase=\"coverlet.collector.dll\" />\r\n    </InProcDataCollectors>\r\n  </InProcDataCollectionRunSettings>\r\n  <LoggerRunSettings>\r\n    <Loggers>\r\n      <Logger friendlyName=\"Console\" uri=\"logger://microsoft/TestPlatform/ConsoleLogger/v1\" assemblyQualifiedName=\"Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger, vstest.console, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" codeBase=\"C:\\Program Files\\dotnet\\sdk\\2.2.401\\vstest.console.dll\" enabled=\"True\" />\r\n    </Loggers>\r\n  </LoggerRunSettings>\r\n</RunSettings>",
  "TestExecutionContext": {
    "FrequencyOfRunStatsChangeEvent": 10,
    "RunStatsChangeEventTimeout": "00:00:01.5000000",
    "InIsolation": false,
    "KeepAlive": false,
    "AreTestCaseLevelEventsRequired": false,
    "IsDebug": false,
    "TestCaseFilter": null,
    "FilterOptions": null
  },
  "Package": null
}
...
TpTrace Error: 0 : 24420, 4, 2019/09/30, 16:41:29.699, 4430772168947, testhost.dll, InProcDataCollectionExtensionManager: Error occured while Initializing the datacollectors : System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.InProcDataCollector.CreateObjectFromType(Type type)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.InProcDataCollectionExtensionManager.CreateDataCollector(String assemblyQualifiedName, String codebase, XmlElement configuration, TypeInfo interfaceTypeInfo)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.InProcDataCollectionExtensionManager.InitializeInProcDataCollectors(String runSettings)

Run settings above(injected) wants to load version 1.0.0.0. but at the moment we are on 1.1.0.0
For now the workaround is override inproc version

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="XPlat code coverage">
        <Configuration>
          <Format>cobertura</Format>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
  <InProcDataCollectionRunSettings>
    <InProcDataCollectors>
      <InProcDataCollector assemblyQualifiedName="Coverlet.Collector.DataCollection.CoverletInProcDataCollector, coverlet.collector, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null"
                     friendlyName="XPlat Code Coverage"
                     enabled="True"
                     codebase="coverlet.collector.dll" />
    </InProcDataCollectors>
  </InProcDataCollectionRunSettings>
</RunSettings>

Issue raise with all runtime version(>= 2.2)

vstest issue ref microsoft/vstest#2205

cc vs test team: @vagisha-nidhi @PBoraMSFT @cltshivash
cc: @tonerdo

@MarcoRossignoli MarcoRossignoli added bug Something isn't working tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly labels Sep 30, 2019
@MarcoRossignoli MarcoRossignoli pinned this issue Oct 1, 2019
@MarcoRossignoli MarcoRossignoli added the driver-collectors Issue related to collectors driver label Oct 7, 2019
@MarcoRossignoli
Copy link
Collaborator Author

Fixed in microsoft/vstest#2221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver-collectors Issue related to collectors driver tracking-external-issue The issue is caused by external problem - nothing we can do to fix it directly
Projects
None yet
Development

No branches or pull requests

1 participant