question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]Coverlet in-process collector is not loaded for version > 1.0.0

See original GitHub issue

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)

The worste thing is that there is no warning/error shown on console.

cc: @vagisha-nidhi @PBoraMSFT @cltshivash @tonerdo

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vagisha-nidhicommented, Dec 3, 2019

@tracker1 The latest preview release contains this fix. Please use that to get yourself unblocked.

0reactions
MarcoRossignolicommented, Dec 3, 2019

I’m a coverlet co-maintainer I don’t work on vstest team(unfortunately 😄) so I don’t know release plan, we need to ask to @vagisha-nidhi BTW you can use preview relase updating package ref in your proj with last one https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/16.5.0-preview-20191115-01

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found