Repository navigation
Description
Describe the bug
After updating to 1.1.1/1.1.2 from 1.0.3 MSTest discovery is now broken. This is a blocking issue for us.
We couldn't test in our CI before because we were blocked by #2631 as well. I tried in the CI, but it seems there may have been something missed with the fix for #2631 as it's trying to install 1.1.1 still for MSTest, see comment here on that issue.
Locally I see the same behavior still I did with 1.1.1:
========== Starting test discovery ==========
[MSTest][Discovery][H:\...\tests\SizerBase.UnitTests.WinAppSdk\bin\x64\Debug\net6.0-windows10.0.19041.0\SizerBase.UnitTests.WinAppSdk.dll] Failed to discover tests from assembly H:\...\tests\SizerBase.UnitTests.WinAppSdk\bin\x64\Debug\net6.0-windows10.0.19041.0\SizerBase.UnitTests.WinAppSdk.dll. Reason:File does not exist: H:\...\tests\SizerBase.UnitTests.WinAppSdk\bin\x64\Debug\net6.0-windows10.0.19041.0\SizerBase.UnitTests.WinAppSdk.dll
No test is available in H:\...\tests\SizerBase.UnitTests.WinAppSdk\bin\x64\Debug\net6.0-windows10.0.19041.0\SizerBase.UnitTests.WinAppSdk.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
========== Test discovery finished: 0 Tests found in 5.1 sec ==========
The file exists on disk, everything built. Only change is updating NuGet reference from 1.0.3 to 1.1.x causes tests now to not be discovered properly/run.
Steps to reproduce the bug
- Create a MSTest based unit test project for WinAppSDK with 1.0.3
- Run tests.
- Close VS
- Clean environment
- Update to 1.1.x
- Re-run tests (fail)
Note, you have to close VS/clean environment as VS caches test discovery, didn't detect this issue at first on initial update as VS used prior cache to run tests. Issue seems to be with test discovery itself.
Expected behavior
Able to run MSTest projects as was able to with 1.0.3.
Screenshots
No response
NuGet package version
1.1.1
Packaging type
No response
Windows version
Windows 10 version 21H2 (19044, November 2021 Update)
IDE
Visual Studio 2022
Additional context
No response
Activity
riverar commentedon Jul 5, 2022
Can reproduce. Here's log output from my test project w/ verbosity cranked up. Not very helpful.
michael-hawker commentedon Jul 5, 2022
Thanks Rafael Rivera (@riverar) for confirmation on another machine. I was hoping to get more details from the CI on our GitHub action as well, but that's been stuck because of #2631 as well (which seems resolved for our main build with 1.1.2 but is failing for the test project still - it seems that 1.1.2 is still trying to install the 1.1.1 package still in that case?).
DefaultRyan commentedon Jul 13, 2022
I tried to reproduce this issue using MSTest 2.2.10, and the test discovery seemed to work.
Were you using MSTest 2.2.10? If 2.2.10 still doesn't work, could you share a minimal repro project? (I'm new to using MSTest).
riverar commentedon Jul 14, 2022
Concur Ryan Shepherd (@DefaultRyan). Looks like this is fixed in 2.2.10, suspect it was related to microsoft/testfx#1064 or microsoft/testfx@6901b31. Michael Hawker (@michael-hawker) tag you're it.
Update MSTest to 2.2.10
michael-hawker commentedon Jul 14, 2022
Thanks folks, we were on
2.2.8indeed. I believe I'll still be blocked from fully validating in our CI by the remaining issue with the fix for #2631 though.I tried locally, and I see test discovery may have found them now, but didn't appear to run them:
Though I don't see anything listed in the Test Explorer now either:

I'm on 17.2.4 of VS, so I'll try updating that as well.
Was able to grab the message from the bubble over the method:
Looks like something may be going on with accessing the
Window.Currentnow that wasn't happening with 1.0.3:Ryan Shepherd (@DefaultRyan) I've invited you to our repo, so you can see the PR with the WinAppSDK and MSTest updates here: CommunityToolkit/Labs-Windows#183 (it's working on our main with WAS 1.0.3 and MSTest 2.2.8).
I'd be curious if you just add the line above with the reference to
Window.Currentin your setup forApp.xaml.cs, if you'll hit the same issue though?I tried putting breakpoints on this line and in the constructor, but I don't see them being hit when I ask it to debug the test from the code bubble.
michael-hawker commentedon Jul 14, 2022
I updated to 17.2.6 and I can see the tests again now in Test Explorer, but still hit the WinRT activation issue now with all the WinUI tests.
DefaultRyan commentedon Jul 18, 2022
Howard Kapustein (@DrusTheAxe) and Hui Chen (@huichen123) may have seen something similar. Could one of you respond here regarding the class activation issue?
Is there a WindowsAppSDK issue, an MSTest issue, or is there some manual configuration that is expected for our customers to use 1.1 with MSTest (and if so, is it documented)?
mikebattista commentedon Jul 18, 2022
Is the app project using MSIX? What about the test project?
michael-hawker commentedon Jul 18, 2022
We're using single-package MSIX projects for both app and tests:
Update MSTest to 2.2.10
michael-hawker commentedon Jul 22, 2022
Still seeing the same message with 1.1.3 locally, though still blocked from testing in our CI by #2768.
Branch is here: https://github.com/CommunityToolkit/Labs-Windows/tree/llama/input-injection-test
Let me know if we should open a separate issue for this specifically, since this original issue on discovery seems to be resolved with latest packages for MSTest+WinAppSDK.
Update MSTest to 2.2.10
michael-hawker commentedon Aug 23, 2022
I believe this issue is resolved in terms of VS, but would like to validate everything is still working in our CI with the latest version; however, that's still blocked by #2768
michael-hawker commentedon Sep 7, 2022
New tracking issue for root cause of issues with 1.1.x is here: #2829
michael-hawker commentedon Nov 16, 2022
Tried 1.2 and getting this in WinAppSDK test run:
(Seemed msbuild was fine though? See action run here: https://github.com/CommunityToolkit/Labs-Windows/actions/runs/3474985456/jobs/5808745741)
FYI Bob Pulliam (@bpulliam) Gabby Bilka (@gabbybilka) Savoy Schuler (@SavoySchuler) as well, as not sure if still related to #2829
michael-hawker commentedon Nov 16, 2022
Ah, looking at https://github.com/actions/runner-images (finally found this) it seems like the OS is still in LTSC from summer:
I can open an issue there, but would be nice to validate E2E and ensure this and #2829 is indeed fixed.
michael-hawker commentedon Feb 9, 2023
So, to follow-up this is kind of resolved, but also still broken with the latest WindowsAppSDK bits...
You need to manually update properties in your project in order to use the new bits with mstest, see thread here: microsoft/testfx#1127
Discovery works fine regardless, but running tests fail with the
class not registeredmessage I had mentioned here above.There should probably be some analyzer or config or something shipped with new versions of the WindowsAppSDK which detects if
<EnablePreviewMsixTooling>is still enabled and prompts folks with the instructions for updating their projects off of 1.0-1.1 (or whichever versions had the preview tooling).FYI Bob Pulliam (@bpulliam)
DrusTheAxe commentedon Feb 10, 2023
+Scott Jones (@Scottj1s)
Evangelink commentedon May 16, 2023
Hey Michael Hawker (@michael-hawker) Scott Jones (@Scottj1s) ,
Sorry for the direct ping but issue was marked as solved in 1.2.X but we are having users saying they still have the issue in this version. What's the status here? Did 1.2.x solved the issue?