Skip to content
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

Add support for STA thread #2682

Merged
merged 9 commits into from
Apr 11, 2024
Merged

Add support for STA thread #2682

merged 9 commits into from
Apr 11, 2024

Conversation

Evangelink
Copy link
Member

When run with MSTest runner, when on Windows and the user specifies ExecutionApartmentState entry in the runsettings and the current thread is not already in the right state, we now create a global thread that switches to the requested apartment state.

When run on VSTest, we rely on VSTest setting the right global state.

The test method execution is also fixed for .NET Core to rely on thread when we need to be on STA thread.

Contributes to #1674

When run with MSTest runner, when on Windows and the user specifies
`ExecutionApartmentState` entry in the runsettings and the current
thread is not already in the right state, we now create a
global thread that switches to the requested apartment state.

When run on VSTest, we rely on VSTest setting the right global state.

The test method execution is also fixed for .NET Core to rely on thread
when we need to be on STA thread.
@eXpl0it3r
Copy link

eXpl0it3r commented Nov 1, 2024

With #2688 / #3278 there are also attributes to enable STA per test class ([STATestClass]) or test method ([STATestMethod]) now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants