runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Need Single Thread Apartment support to allow use of some COM objects

Open jeffbi opened this issue 9 years ago • 4 comments

PowerShell cmdlets Enable-WSManCredSSP and Disable-WSManCredSSP require use of IGroupPolicyObject, which requires STA.

The PowerShell folk need to be able to port those cmdlets to Core (see PowerShell/PowerShell#3353)

This relates to an earlier corefx issue, dotnet/runtime#14015.

jeffbi avatar Mar 31 '17 00:03 jeffbi

cc @yizhang82 @kouvel - do you guys have any insights here?

karelz avatar Mar 31 '17 02:03 karelz

Thread.SetApartmentState and Thread.TrySetApartmentState are available now in the latest Core, they can be called on a Thread instance before starting the thread to start it in STA mode. .NET Core 2.0.0 would include these APIs.

kouvel avatar Mar 31 '17 03:03 kouvel

If it is main thread, use [STAThread]. It is also available in .NET Core 2.0

yizhang82 avatar Mar 31 '17 03:03 yizhang82

Very cool. Closing as fixed in 2.0 then.

karelz avatar Mar 31 '17 04:03 karelz