-
Notifications
You must be signed in to change notification settings - Fork 259
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
[3.0 regression] Unable to run a test with timeout in STA ApartmentState #1616
Comments
Hi @cremor, thanks for your feedback! |
@engyebrahim Thanks for confirming. But why did you tag this issue as a feature? I'd say that this is a bug. |
@cremor because it's related to this one #320 and also to making something like this MSTest.STAExtensions inside mstest. by making default behaviour and a decorator to use the other behaviour. |
But the default behavior worked in 2.2.10. |
@engyebrahim Thanks for reclassifying this as a bug. Is there a chance that this will be fixed in a 3.0.x release? |
Hi @cremor we will discuss it and let you as soon as possible |
@engyebrahim any update on this ? I'm doing some porting between .net framework and .net 6.0 on my unit test with WPF and i'm getting It seems there is a different of behavior between .net framework and .net 6.0 and would like to know what is the expectation. Seems you were having some discussion. Let me know if you need a different issue |
We are still investigating the issue (more precisely the fix). I confirm @cremor investigation that the change is a side-effect of merging the timeout behaviors hence using We will get back to you asap. |
Salut @Evangelink ! This is blocking us we are trying to have the same WPF unit test compiled and running with 2 different framework - .NET Fwk/.NET 6.0 with the differene MTA/STA between both frameworks. |
Hi @fforjan, Sorry it's taking some time but we are exploring the solution to fix this issue. If we don't find something reasonable quickly we will probably revert the linked change in a bug fix version and plan to reapply the change in a later update when we have a proper upgrade path for users. |
Might be related to microsoft/vstest#1865 |
@Evangelink in my case, yes ! |
I haven't been able to make lots of progress on that today but I noticed that depending on target framework the testhost was using different mode and I found the linked issue. |
@cremor we have reverted the change and will include the fix in 3.0.3 (we hope to ship it next week). @fforjan I believe this revert won't be enough for you as you would want to run some tests with STA using .NET 6 and this won't be possible (it was not possible in previous versions of MSTest). I have created #1674 to track providing a good solution for this use case. |
Describe the bug
MSTest v2 ran all tests in STA ApartmentState when executed in a .NET Framework runtime. v3 runs "normal" tests still in STA, but tests that have a
TimeoutAttribute
applied now run in MTA.Steps To Reproduce
Run these tests with various versions of MSTest and runtimes:
Expected behavior
Either MSTest v2 behavior should be retained, or I should have a way to force STA on an unit test.
Actual behavior
Tests with timeout always run in MTA.
Additional context
I need STA to run UI (WPF) tests. Those tests try to execute WPF commands which now fail with
InvalidOperationException: The calling thread must be STA, because many UI components require this.
This is most likely a side effect of #1296
The package "MSTest.STAExtensions" which is mentioned in #21 does not help/work, see saikrishnav/testfxSTAext#5
Related: #320
AB#1822144
The text was updated successfully, but these errors were encountered: