Skip to content

Commit 0ed893a

Browse files
apply apt state for PS7 (PowerShell#1051)
1 parent 96fb6c2 commit 0ed893a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class PowerShellContextService : IDisposable, IHostSupportsInteractiveSes
3939
static PowerShellContextService()
4040
{
4141
// PowerShell ApartmentState APIs aren't available in PSStandard, so we need to use reflection
42-
if (!VersionUtils.IsNetCore)
42+
if (!VersionUtils.IsNetCore || VersionUtils.IsPS7)
4343
{
4444
MethodInfo setterInfo = typeof(Runspace).GetProperty("ApartmentState").GetSetMethod();
4545
Delegate setter = Delegate.CreateDelegate(typeof(Action<Runspace, ApartmentState>), firstArgument: null, method: setterInfo);

0 commit comments

Comments
 (0)