vstest: InProcDataCollection not loading tested assemblies

This issue is more of a question than a bug. I didn’t see github discussions here so I created this issue. Please sent me to the right place if this isn’t the place to ask questions.

What should the order of assemblies loaded be when using InProcDataCollection? I’d expect the tested assembly would be loaded once the tests are being run. But this is not always the case for me.

Steps to reproduce

I’ll add if needed

Expected behavior

InProcDataCollector loads tested assemblies before test is started so they can be requested using: AppDomain.CurrentDomain.GetAssemblies() or AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoaded; And the assembly can be used to call a class inside the tested assembly

Actual behavior

The tested assembly is not loaded and also hasn’t loaded when the first testcase is finished.

This breaks my app.

Diagnostic logs

Please share test platform diagnostics logs. Instructions to collect logs are here.
The logs may contain test assembly paths, kindly review and mask those before sharing.

Environment

I’m running on windows 10 using vstest.console version 17.2.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

Glad to hear that is not a bug 😄 thanks for your patience.

I was struggling to produce a list of current assemblies. I always checked the list by using the visual studio debugger and searched for the assembly name. This never resulted in a match, even though other assemblies could be found. But now I changed the line to:

var assemblies = AppDomain.CurrentDomain.GetAssemblies().Select(x => x.GetName().Name);

And I was surprised! Suddenly the assembly was found in this list. So it looks like you were right. After further investigation, I found a bug in our code that also could explain this behavior. I’ll close this issue as it seems like we were just checking the facts wrong. I’m sorry for the inconvinience. Thanks for your help

@MarcoRossignoli It looks like you’re looking at the test project (project containing unit tests) and not the project under test (project being tested by unit test project). It is the project under test that is instrumented. I see that I made a typo in my comment, my apologies. All this test assembly and assembly under test is prone to errors and confusion imo.

I will try to gather the actual names of the projects to try and make this less confusing…