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.

Coverlet crashes VSTest

See original GitHub issue

I’m getting errors when I’m trying to use the vstest integration to coverlet.

This is with the 2.2.300 SDK.

 PS> dotnet test --no-build --no-restore --settings ..\CodeCoverage.runsettings --collect:"XPlat Code Coverage"  -- RunConfiguration.DisableAppDomain=true
Test run for D:\dev\xUnit\visualstudio.xunit\test\test.xunit.runner.visualstudio\bin\Debug\net46\test.xunit.runner.visualstudio.dll(.NETFramework,Version=v4.6)
Microsoft (R) Test Execution Command Line Tool Version 16.1.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...


Attachments:
  D:\dev\xUnit\visualstudio.xunit\test\test.xunit.runner.visualstudio\TestResults\730034da-8dc8-4a52-9bdf-db094514cf10\coverage.cobertura.xml
  D:\dev\xUnit\visualstudio.xunit\test\test.xunit.runner.visualstudio\TestResults\730034da-8dc8-4a52-9bdf-db094514cf10\Oren_ATHENA_2019-06-25.16_25_17.coverage

Test Run Aborted.

To repro:

  • clone https://github.com/xunit/visualstudio.xunit
  • checkout the coverlet branch
  • from a VS Command prompt, go to the /test/test.xunit.runner.visualstudio directory
  • run msbuild /restore to build the test project (and the project it’s testing). You’ll need the Windows/UWP 16299 SDK installed to successfully build it.
  • From the same directory, run the following command dotnet test --no-build --no-restore --settings ..\CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true

It’ll start running the tests and then abort.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
vagisha-nidhicommented, Jun 26, 2019

@onovotny So I have looked at this. In your runsettings you define both data collectors “CodeCoverage” and “Xplat Code coverage” I tried both, and both of them are aborting the run. I don’t have an RCA on the CodeCoverage one but for xplat code coverage, here’s my analysis.

In test.xunit.runner.visualstudio, there’s a condition

  <ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
    <PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="15.9.0" />
  </ItemGroup>

This is causing it to refer to old objectmodel which does not work with coverlet. Getting this error when I looked at logs using --diag option

Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection.SessionStartEventArgs..ctor(System.Collections.Generic.IDictionary`2<System.String,System.Object>)'.
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.EventHandlers.TestCaseEventsHandler.SendSessionStart(IDictionary`2 properties)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithSources.SendSessionStart()
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTests().

Can you try with updating the object model and disabling data collector for CodeCoverage and see if xplat code coverage works?

cc: @MarcoRossignoli

1reaction
vagisha-nidhicommented, Jun 26, 2019

@MarcoRossignoli @onovotny I’ll try to repro the issue and get back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coverlet crashes VSTest · Issue #475
I'm getting errors when I'm trying to use the vstest integration to coverlet. This is with the 2.2.300 SDK. PS> dotnet test --no-build ......
Read more >
VSTest@2 Task is Updating / Overriding coverlet. ...
I am trying to add code coverage to a .NET Framework 4.8 solution in Azure DevOps. I have based my approach on the...
Read more >
Configure unit tests by using a .runsettings file
To run tests from the command line, use vstest.console.exe, ... can help you isolate a problematic test that causes a test host crash....
Read more >
Error 'Unable to read beyond the end of the stream. ' in CL ...
Hello,. starting from yesterday we are encountering the following error during build test and collecting test results
Read more >
coverlet
Coverlet is a cross platform code coverage framework for .NET, with support for line, ... VSTest engine integration; MSBuild task integration; As a...
Read more >

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