-
Notifications
You must be signed in to change notification settings - Fork 323
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 #2221
Conversation
@vagisha-nidhi can you please look |
@MarcoRossignoli What is the status of this PR? |
@vagisha-nidhi I would like to test it on my test project...but I don't know the correct steps, can you link me some guide or describe how I can use my local build of test host? |
@MarcoRossignoli You can gereate the local binaries by using build.cmd on the root folder. This will generate artifacts/Debug/net451/win7-x64 which contain all built binaries. You can just test your dll with |
@vagisha-nidhi if I want to update and re-test should I rebuild all or I can rebuild only specific project in visual studio? |
@vagisha-nidhi I cannot load collectors
|
Just build the particular project where your changes are and replace the net451 binaries in the artifacts folder. |
Oh I got it. The coverlet.collector targets file sets the test adapter path to its nuget location. This will happen only when dotnet test is being run. So you won't be able to load the collector. As far as I remember coverlet.collector with vstest.console.exe is broken due to some other reason as well. |
@vagisha-nidhi did a test...I used my build package and updated custom nuget.config and overwritten Microsoft.TestPlatform.CrossPlatEngine to attach and all seem work as expected.
You can do a review. |
@@ -79,6 +79,27 @@ public void InProcDataCollectorShouldInitializeIfAssemblyContainsAnyInProcDataCo | |||
Assert.AreEqual(this.inProcDataCollector.AssemblyQualifiedName, typeInfo.AssemblyQualifiedName); | |||
} | |||
|
|||
[TestMethod] | |||
public void InProcDataCollectorLoadCoverlet() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test verify that also if aqn shows version 1.0.0.0 we correctly load a version 9.9.9.9 of lib
@@ -0,0 +1,40 @@ | |||
using System.Reflection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added custom test assets, fake coverlet.collector.dll lib
ping @vagisha-nidhi for review...maybe we can fix this before 3.1 release. |
@vagisha-nidhi @singhsarab can somebody please take a look? Marco asked me to ping you as this impacts coverlet. thanks. |
@vagisha-nidhi is OOF this week. |
using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollector.InProcDataCollector; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.InProcDataCollector; | ||
|
||
[assembly: AssemblyKeyFile("key.snk")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this key file for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly 2 reason
-
Without signed assembly I cannot compile I get an error that force me to have a strong name asm.
-
After this merge we have on backlog this Sign collector and update visibility coverlet-coverage/coverlet#566 so I'll update this key here and will amend test and alg to check also "public key token".
{ | ||
// If we're loading coverlet collector we skip to check the version of assembly | ||
// to allow upgrade throught nuget package | ||
filterPredicate = (x) => x.FullName.Equals(Constants.CoverletDataCollectorTypeName) && interfaceTypeInfo.IsAssignableFrom(x.GetTypeInfo()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mayankbansal018 Should we make this default ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no, If I'm not mistaken that aqn is read from possible runsetting file so a user should have that assembly in local folder. The issue with coverlet is that we(you) inject hardcoded aqn if user provide --collect:"XPlat Code Coverage"
.
It works well for user provided collectors because there is always a runsettings file provided, but with coverlet don't, so we need a way to make it works for every version without runsettings file.
So my idea is to check only "trusted" type/lib name only for coverlet.
BTW I could miss something in the big picture.
@MarcoRossignoli Vagisha is OOF this week, she should be able to pick this up coming Monday, we apologize for the delay. |
@singhsarab I resolved the conflicts there was an error on string format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vagisha-nidhi is there a way to dogfood vstest packages? |
@MarcoRossignoli Here is the myget link where the recent build gets uploaded https://dotnet.myget.org/feed/vstest/package/nuget/Microsoft.NET.Test.Sdk/16.5.0-preview-20191113-01 |
Thanks! |
Great! |
Fixes for #2205
cc: @tonerdo