-
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
Only send Coverlet in proc datacollector dll to testhost #2226
Only send Coverlet in proc datacollector dll to testhost #2226
Conversation
@@ -261,7 +267,9 @@ private void LogMessage(TestMessageLevel testMessageLevel, string message) | |||
private void InitializeExtensions(IEnumerable<string> sources) | |||
{ | |||
var extensions = TestPluginCache.Instance.GetExtensionPaths(TestPlatformConstants.TestAdapterEndsWithPattern, this.skipDefaultAdapters); | |||
extensions = extensions.Concat(TestPluginCache.Instance.GetExtensionPaths(TestPlatformConstants.DataCollectorEndsWithPattern, true)).ToList(); | |||
|
|||
// remove this line once we figure out why coverlet inrpoc DC is not initialized via runsetting inproc node. |
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.
Nit: inproc
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.
done
extensions = extensions.Concat(TestPluginCache.Instance.GetExtensionPaths(TestPlatformConstants.DataCollectorEndsWithPattern, true)).ToList(); | ||
|
||
// remove this line once we figure out why coverlet inrpoc DC is not initialized via runsetting inproc node. | ||
extensions = extensions.Concat(TestPluginCache.Instance.GetExtensionPaths(ProxyExecutionManager.CoverletDataCollector, true)).ToList(); |
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.
Assuming the LUT inproc data collector gets initialized via runsettings
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 code was recently added, so LUT should not be dependent on it, will double check though
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.
LUT inproc datacollector would be providing full codebase path in runsettings, which wouldn't depend on this flow.
// Only send coverlet inproc datacollector dll to be initialized via testhost, | ||
// ideally this should get initialized via InProcessDC Node in runsettings, but | ||
// somehow it is failing, hence putting this ugly HACK, to fix issues like | ||
// https://developercommunity.visualstudio.com/content/problem/738856/could-not-load-file-or-assembly-microsoftintellitr.html |
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.
In the runsettings, we do not send the complete codebase path for coverlet. We send just the dll name (coverlet.collector.dll). Later, in test host while initializing the inproc data collector, we look for all directories from where (datacollector)extensions were loaded and try to find the coverlet.collector.dll in those paths. (https://github.com/microsoft/vstest/blob/master/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs#L69)
If there's a way we can add the full codebase in runsettings, then this can be avoided.
hi, there.
It fails to get type Microsoft.VisualStudio.TraceDataCollector. Do I miss something? I'm using MSVS Communitiy 16.3.6. My tests assembly refers: It is built for netcoreapp3 and netframework 4.6.1. Tests are able to start for netframework version. but not able to netcoreapp 3.0 |
I've got a similar error using: wiht VS2019 community 16.4.0 preview 4 and VS2019 community 16.3.8: In a netcoreapp 3.0 nunit test project: System.Reflection.ReflectionTypeLoadException Please help |
@mayankbansal018 , @singhsarab , @vagisha-nidhi : Wouldn't the same error be thrown if any of the adapter assemblies supplied are full framework too? |
Bug: https://developercommunity.visualstudio.com/content/problem/738856/could-not-load-file-or-assembly-microsoftintellitr.html
RC: Earlier we were loading all datacollector dll's in testhost process. In case of netcore test where dotnet is launched, we started loading FullCLR dlls inside testhost process. Now loading dlls was okay, but the moment user did
AppDomain.CurrentDomain.GetAssemblies().First(asm => asm.DefinedTypes.Any(t => t.FullName == "foo"))
it would failThis was because the above line would cause dependent dll of FullCLR dll's to be loaded, which if not found would throw FileNotFoundException, & user code/test code would start failing.
We are white-listing coverlet inproc dll to be loaded in testhost process. Please see code comments to understand why, & how it should be fixed