microsoft / testfx

MSTest framework and adapter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSTest is broken when using deployment items

Evangelink opened this issue · comments

Hi guys, I'm having the same issue on VS 2022 LTSC 17.8.10. I upgraded my VS last night along with installing Python extensions and my test project running on .Net Framework 4.8 started failing with the same issue. First, I tried updating the MSTest Nuget to the latest 3.4.0 and it didn't solve the issue, with/out DisableAppDomain. The only thing that worked for me is downgrading MSTest to 2.2.6

So, is there a valid fix to this?

Originally posted by @ndenkha in #1493 (comment)

Yesterday everything was fine. But today I experienced some similar issue, when I had updated the depended:

  1. MSTest.TestAdapter
  2. MSTest.TestFramework
    ;

I looked into the output panel by selecting "Test" there. It complains :
-------begin---------
Could not load type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestIdGenerationStrategy' from assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-------end--------
The "Debug Tests", activated from context menu, finished silently. And the status bar sometimes displayed:
tests aborted: 0 tests run ... ( or something like that).

I then created a brand-new unit test project in visual studio, and found it works fine (that is: no above issue). I then noted from its dependencies for that two packages, and each is versioned at 2.2.10.

I tried to downgrade the two packages each to the immediate previous version, but the resulted project still did not work (for this step, I didnot investigate thoroughly; so I am not sure whether there might be other reasons that would contribute to the problem, making it not work).

I finally downgraded the two packages to v2.2.10, and also cleaned some residue "imports" of any unwanted test packages in the ".csproj" files ( and also commented some "error" template message in the ".csproj", but that is just a preempt preventive measure, and I am not sure that would contribute to the issue). I also deleted "bin/" and "obj/" folder, just in case, and inspected the references and the "packages.config" file to make sure nothing looks suspicious. And it finally worked.

Looks like it could be related to #2922 where regression in assembly resolving was introduced.

I have tried with the repro file from the original issue and couldn't repro the issue on 3.4.0 so I will need you to provide us with a reproducer for the bug. As pointed out by @nohwnd we had an issue with the assembly resolver that plays part in the deployment feature so it's most likely linked.

Probably related to #3019

Closing as fixed. Please provide a repro if your issue is different.