Skip to content

Commit 82d5913

Browse files
authored
Use [initialsessionstate] type accelerator (PowerShell#25912)
1 parent 4e69452 commit 82d5913

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

test/powershell/Language/Classes/Scripting.Classes.BasicParsing.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ class Derived : Base
833833
[Derived]::new().foo()
834834
'@)
835835

836-
$iss = [System.Management.Automation.Runspaces.initialsessionstate]::CreateDefault2()
836+
$iss = [initialsessionstate]::CreateDefault2()
837837
$iss.Commands.Add($ssfe)
838838

839839
$ps = [powershell]::Create($iss)
@@ -929,7 +929,7 @@ class A : Foo.Bar
929929
return [A]::new()
930930
'@)
931931

932-
$iss = [System.Management.Automation.Runspaces.initialsessionstate]::CreateDefault()
932+
$iss = [initialsessionstate]::CreateDefault()
933933
$iss.Commands.Add($ssfe)
934934

935935
$ps = [powershell]::Create($iss)

test/powershell/Language/Classes/scripting.Classes.using.tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ function foo()
417417
'@
418418
# resolve name to absolute path
419419
$scriptToProcessPath = (Get-ChildItem $scriptToProcessPath).FullName
420-
$iss = [System.Management.Automation.Runspaces.initialsessionstate]::CreateDefault()
420+
$iss = [initialsessionstate]::CreateDefault()
421421
$iss.StartupScripts.Add($scriptToProcessPath)
422422

423423
$ps = [powershell]::Create($iss)

test/powershell/Modules/Microsoft.PowerShell.Utility/Export-FormatData.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Describe "Export-FormatData" -Tags "CI" {
1616
{
1717
$fd | Export-FormatData -Path $TESTDRIVE\allformat.ps1xml -IncludeScriptBlock
1818

19-
$sessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()
19+
$sessionState = [initialsessionstate]::CreateDefault()
2020
$sessionState.Formats.Clear()
2121
$sessionState.Types.Clear()
2222

@@ -135,7 +135,7 @@ Describe "Export-FormatData" -Tags "CI" {
135135
$testfile = Join-Path -Path $TestDrive -ChildPath "$testfilename.ps1xml"
136136
Set-Content -Path $testfile -Value $xmlContent
137137

138-
$sessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()
138+
$sessionState = [initialsessionstate]::CreateDefault()
139139
$sessionState.Formats.Clear()
140140
$sessionState.Types.Clear()
141141

test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ try
19011901
Export-PSSession -Session $session -OutputModule $tempdir\Diag -CommandName New-Guid -AllowClobber > $null
19021902

19031903
# Only the snapin Microsoft.PowerShell.Core is loaded
1904-
$iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault2()
1904+
$iss = [initialsessionstate]::CreateDefault2()
19051905
$ps = [PowerShell]::Create($iss)
19061906
$result = $ps.AddScript(" & $tempdir\TestBug450687.ps1").Invoke()
19071907

test/powershell/Modules/Microsoft.PowerShell.Utility/Remove-TypeData.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Describe "Remove-TypeData DRT Unit Tests" -Tags "CI" {
3636

3737
BeforeEach {
3838
$ps = [powershell]::Create()
39-
$iss = [system.management.automation.runspaces.initialsessionstate]::CreateDefault2()
39+
$iss = [initialsessionstate]::CreateDefault2()
4040
$rs = [system.management.automation.runspaces.runspacefactory]::CreateRunspace($iss)
4141
$rs.Open()
4242
$ps.Runspace = $rs

test/powershell/Modules/Microsoft.PowerShell.Utility/Update-FormatData.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Describe "Update-FormatData with resources in CustomControls" -Tags "CI" {
110110
$templatePath = Join-Path $PSScriptRoot (Join-Path 'assets' 'UpdateFormatDataTests.format.ps1xml')
111111
$formatFilePath = Join-Path $TestDrive 'UpdateFormatDataTests.format.ps1xml'
112112
$ps = [powershell]::Create()
113-
$iss = [system.management.automation.runspaces.initialsessionstate]::CreateDefault2()
113+
$iss = [initialsessionstate]::CreateDefault2()
114114
$rs = [system.management.automation.runspaces.runspacefactory]::CreateRunspace($iss)
115115
$rs.Open()
116116
$ps.Runspace = $rs

test/powershell/Modules/Microsoft.PowerShell.Utility/Update-TypeData.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Describe "Update-TypeData basic functionality" -Tags "CI" {
3737

3838
BeforeEach {
3939
$ps = [powershell]::Create()
40-
$iss = [system.management.automation.runspaces.initialsessionstate]::CreateDefault2()
40+
$iss = [initialsessionstate]::CreateDefault2()
4141
$rs = [system.management.automation.runspaces.runspacefactory]::CreateRunspace($iss)
4242
$rs.Open()
4343
$ps.Runspace = $rs

0 commit comments

Comments
 (0)