-
Notifications
You must be signed in to change notification settings - Fork 388
0% coverage reported on netfx target #705
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
Comments
@MarcoRossignoli I created my collector config based on an older version of the workaround doc. I see current examples omit the I'm also not understanding the connection between the I don't doubt I've missed something in my config, but my recollection is that when I dug into the logs on my previous attempt to solve this, I could see coverlet.collector was being invoked but still failing to collect anything. |
Yes in-process collector is injected automatically when we use
Yes, when you pass --collect:"XPlat Code Coverage" OutOfProc and InProc collectors will be loaded using coverlet.collector.dll you reference. The settings file is needed to specify non default options and they flow to OutOfProc collector.
There is a bug in vstest on inproc loading...so we need for now to update to a preview version microsoft/vstest#2221 I cloned and tested your sample and with following command I get coverage <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0;netcoreapp2.1;net46</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<!-- To update in future with stable version -->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0-preview-20200116-01" />
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Json" Version="4.6.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Blake2Fast\Blake2Fast.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="blake2-kat.json" />
</ItemGroup>
</Project> And this is the command line
You can enable logging Let me know! |
@saucecontrol I've updated vstest guide with more details https://github.com/tonerdo/coverlet/blob/master/Documentation/VSTestIntegration.md |
Thanks again for looking into this and for the doc update. That clears some things up for sure. From what I can see, at worst I had some redundant config values set. I don't see anything different in your example than what I've tried. However, AFAIK if you don't specify otherwise, the tests run in 32-bit mode, which has been working for me all along on my local machine. I'll give it a shot again, but that config has consistently failed (tests run, but 0 coverage reported) in Azure Pipelines even when the identical config worked locally. When I specify x64 TargetPlatform, I get the same failure locally that I get in CI. |
I'll force x64 asap and come back!You're right I didn't do that test. |
Cool, let me know. I'm actually not sure if the failure I see locally in x64 has anything in common with the CI failure besides the 0% result; it was just the only way I could get it to fail reliably locally with the same symptom. If you're not able to identify anything, I'll see if I can get some good logs from CI with the current versions of everything since that's the problem I'm actually trying to solve. |
I can repro with collectors and it happens only for net46 x64(resolve issue on test host), next days I'll try to understand if happens also with msbuid. |
I did a test and found the issue, is related to coverlet in-proc load failure, vstest plat try to load netcoreapp2.1 lib inside a netfx process and fails TL;DR; Now the issue is that in-proc coverlet collector was written with netcoreapp2.1 tfm(I asked to vstest team why, they wrote it) so when vstest plat try to load it a lot of ref failure happens
When this happen and vstest plat kill process we suffer again of know issue above so we cannot persist hit file...and this is randomic, I mean can happen for x64 and not for x86 and vice-versa.
I did some test with a collector compiled for netstandard2.0+vstest master compiled plat and it works...btw I found also a past statement of vstest team #466 (comment) so the past idea was support only netcoreapp, but now that we have an unsolvable issue with automatic process kill(above know issue) maybe we should change the idea...or abandon netfx(try msbuild and if you hit issue above...no solution) |
closed in #970 |
@MarcoRossignoli I'm just now trying to test that fix, but the latest nightly build I see on MyGet is from August. Are those published somewhere else now? |
Yep we're a bit in trouble with nightly we're moving to AzDo but I'm a bit busy at the moment so sorry, for now you can try on my personal unofficial feeds I use for tmp fixing/test https://f.feedz.io/marcorossignoli/coverletunofficial/nuget/index.json Last version should work on netfx. Let me know! |
It's no problem at all. I just wanted to try it out before 3.0 lands since I had a free minute. Tried the private feed 3.0.0-preview.1, and it's working great now. Thanks much! |
Glad to hear that! |
Migrating this issue over from #578 comments
When running tests locally, I get correct results with netfx target on 32-bit
with the following runsettings:
However, if I switch to
<TargetPlatform>x64</TargetPlatform>
, I get 0% coverage.On Azure Pipelines, I get 0% coverage under either config.
The netcore targets are correct no matter how I run.
I have tried the coverlet.collector workarounds from https://github.com/tonerdo/coverlet/blob/master/Documentation/KnowIssues.md#2-upgrade-coverletcollector-to-version--100 with no change in results.
My current config can be found here: https://github.com/saucecontrol/Blake2Fast/tree/azure-coverage
And the updated cmdline I'm using with coverlet.collectors is
The text was updated successfully, but these errors were encountered: