Coverlet: Test run fails on netcoreapp1.0 targeted tests

Created on 12 Jun 2019  路  11Comments  路  Source: coverlet-coverage/coverlet

When running tests on linux (in Azure Pipelines at least) with code coverage turned on...

dotnet test src --no-build -c Release --filter "TestCategory!=FailsInCloudTest" -v n -l trx /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura

The build log shows this failure when the tests run on .NET Core 1.0:

[xUnit.net 00:00:01.64]       System.IO.FileNotFoundException : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
[xUnit.net 00:00:01.64]       Stack Trace:
[xUnit.net 00:00:01.64]            at Coverlet.Core.Instrumentation.Tracker.Nerdbank.Streams_42ec0704-f64b-48c0-a903-a8b9be93bc98.RecordHit(Int32 )
[xUnit.net 00:00:01.64]         D:\a\1\s\src\Nerdbank.Streams\Sequence`1.cs(43,0): at Nerdbank.Streams.Sequence`1..ctor()
[xUnit.net 00:00:01.64]         D:\a\1\s\src\Nerdbank.Streams.Tests\BufferWriterStreamTests.cs(25,0): at BufferWriterStreamTests..ctor(ITestOutputHelper logger)
documentation enhancement

Most helpful comment

So I think that we can close this for the moment.

All 11 comments

Yes I did some check and the issue seem mainly 2 packages
Mono.Cecil 0.10.1
Microsoft.Extensions.FileSystemGlobbing 2.0.1

that are supported only on netstandard2.0 and collector tfm is netcoreapp2.0

@vagisha-nidhi is there are reason to not build collector lib for netstandard2.0?
If so we could update guide to report that minimal support is netstandard2.0 runtimes.

@MarcoRossignoli Although the coverlet integration for now will be working for only .NET Core projects, that might be the reason of not making this netstandard targeted.

Fair I agree, is there a plan to support netfx?

Fair I agree, is there a plan to support netfx?

cc: @cltshivash @PBoraMSFT

I just checked, and Mono.Cecil actually targets netstandard1.3. Why do you say it requires netstandard2.0?

Also, an older version of Microsoft.Extensions.FileSystemGlobbing supports netstandard1.3 as well.

So maybe .NET Core 1.0 could be supported?

We use version https://github.com/tonerdo/coverlet/blob/master/src/coverlet.core/coverlet.core.csproj#L19 https://www.nuget.org/packages/Microsoft.Extensions.FileSystemGlobbing/2.0.1 for FileSystemGlobbing
For Cecil you're right...I misread...btw I retry because I get error on build moving to 1.0
EDIT: I had tested with netstandard1.0 Package Mono.Cecil 0.10.1 is not compatible with netstandard1.0 with 1.3 it's ok.

@AArnott maybe with some updates we could support on netstandard1.3 with downgrade to FileSystemGlobbing and removing ExcludeFromCodeCoverageAttribute usage on tracker template and skip "by hand".

C:\git\coverlet (master -> origin)                                                                                                                                                                        
位 dotnet build                                                                                                                                                                                            
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core                                                                                                                                      
Copyright (C) Microsoft Corporation. All rights reserved.                                                                                                                                                 

  Restore completed in 57,49 ms for C:\git\coverlet\src\coverlet.console\coverlet.console.csproj.                                                                                                         
  Restore completed in 58,5 ms for C:\git\coverlet\test\coverlet.collector.tests\coverlet.collector.tests.csproj.                                                                                         
  Restore completed in 57,73 ms for C:\git\coverlet\src\coverlet.collector\coverlet.collector.csproj.                                                                                                     
  Restore completed in 54,64 ms for C:\git\coverlet\test\coverlet.testsubject\coverlet.testsubject.csproj.                                                                                                
  Restore completed in 60,71 ms for C:\git\coverlet\src\coverlet.msbuild.tasks\coverlet.msbuild.tasks.csproj.                                                                                             
  Restore completed in 60,67 ms for C:\git\coverlet\src\coverlet.core\coverlet.core.csproj.                                                                                                               
  Restore completed in 60,36 ms for C:\git\coverlet\test\coverlet.core.performancetest\coverlet.core.performancetest.csproj.                                                                              
  Restore completed in 60,41 ms for C:\git\coverlet\test\coverlet.core.tests\coverlet.core.tests.csproj.                                                                                                  
  Restore completed in 25,52 ms for C:\git\coverlet\test\coverlet.core.tests\coverlet.core.tests.csproj.                                                                                                  
Instrumentation\ModuleTrackerTemplate.cs(16,6): error CS0122: 'ExcludeFromCodeCoverageAttribute' is inaccessible due to its protection level [C:\git\coverlet\src\coverlet.core\coverlet.core.csproj]     
  coverlet.testsubject -> C:\git\coverlet\test\coverlet.testsubject\bin\Debug\netcoreapp2.0\coverlet.testsubject.dll                                                                                      

Build FAILED.                                                                                                                                                                                             

Instrumentation\ModuleTrackerTemplate.cs(16,6): error CS0122: 'ExcludeFromCodeCoverageAttribute' is inaccessible due to its protection level [C:\git\coverlet\src\coverlet.core\coverlet.core.csproj]     
    0 Warning(s)                                                                                                                                                                                          
    1 Error(s)                                                                                                                                                                                            

Time Elapsed 00:00:03.60                                                                                                                                                                                  

@AArnott following up https://twitter.com/aarnott/status/1147714360757719041 I wonder if make sense for coverlet support framework out of LTS.
It's true that coverage is a "cross" activity and support old code could be a plus, maybe multitargeting.

cc: @tonerdo

I'm planning to cut support for it from my libraries at this point.

I'm on board with cutting out support for < netstandard2.0

So I think that we can close this for the moment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  5Comments

hlubovac picture hlubovac  路  5Comments

arpit-nagar picture arpit-nagar  路  4Comments

felixfbecker picture felixfbecker  路  6Comments

SteveGilham picture SteveGilham  路  6Comments