Powershell: add back options for STA

Created on 1 Jul 2018  路  8Comments  路  Source: PowerShell/PowerShell

Add command line option to specify apartment state and ability to create runspace with apartment state

Issue-Enhancement Resolution-Fixed WG-Engine

All 8 comments

Related #4995

What are the plans here in terms of timeline/expectations as this could be important for WPF? Add STA for PS 7.0? Or is it too much involved and will come only in 7.1? @SteveL-MSFT

@bergmeister agree that this is probably needed for WPF to work with 7, so we should do this for 7.0.

We preserved all apartment code. Only .Net Core has probably deviations from .Net Framework.

@iSazonov Except for the -Sta and -Mta switches on the pwsh binary that were removed in #4995

Has MSFT team tests for the code area?

@iSazonov I searched the old tests and they don't seem comprehensive. All it really does is use -STA with powershell.exe and validates that the apartmentstate is set correctly. Ideally, we should include a specific test like using a COM object that requires STA or even WPF (not getting an exception). Also manually run all tests with -STA to see if anything fails unexpectedly.

:tada:This issue was addressed in #10061, which has now been successfully released as v7.0.0-preview.3.:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings