$test = {
function makeform {
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
[System.Windows.Forms.Application]::EnableVisualStyles();
$form = New-Object Windows.Forms.Form
$form.Text = 'Test Form'
$form.Add_Shown({$form.Activate()})
$form.ShowDialog()
}
}
Start-Job { makeform } -InitializationScript $test
---------------------------------
PS C:\WINDOWS\system32> D:\AMS\scripts\MaybeBug.ps1
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
7 Job7 BackgroundJob Running True localhost makeform
----------------------------------
Visual Stu
Id Name PSJobTypeName State HasMoreData Location Command
-- ---- ------------- ----- ----------- -------- -------
1 Job1 BackgroundJob Failed False localhost makeform
Awesome! Keep your eyes out for this in the next release!
I bet the issue that @GoateePFE is seeing is the same bug as https://github.com/PowerShell/PowerShellEditorServices/issues/554. It only happens on non-Windows systems. I know right where the issue lies (documented in the aforementioned issue and my first attempt to fix it - https://github.com/PowerShell/PowerShellEditorServices/pull/557).
@tylerl0706 In the Windows PowerShell Integrated Scripting Editor (ISE), F8 became the standard shortcut to run the “current line” that the cursor is on (if there is no editor selection) or “current selection” (if there is an editor selection).
So, I’m guessing that what @GoateePFE means by “F8 method” is that he’s simply putting the cursor on a line with a
Start-Jobcommand and simply hitting F8 to invoke that line, as opposed to manually typing theStart-Jobcommand into the VSCode Integrated Terminal.