Packaged PS1 EXE crashing

Tool: Visual Studio, Visual Studio Code, PSScriptPad, PowerShell Module
Version: 

After packaging my PS1 file I can use some of it but not all of it. When running one of the commands linked to a button the commands will start and after a certain amount of time the exe will just close out without warning or crash report. Please help!!! I also noticed that the output console in VSCode is throwing a ton of errors and sometimes I have to restart it to get it to package at all.

Below is some of the output:

Starting PowerShell Pro Tools host from: c:\Users\curtp.vscode\extensions\ironmansoftware.powershellprotools-5.26.0\out\windows\PowerShellProTools.Host.exe}

Process started

connect

Started to PowerShell Pro Tools process.

Scheduling command for main runspace: $Commands = Get-Command ‘Set-Variable’ -ErrorAction SilentlyContinue; if ($Commands) { try { [System.Management.Automation.ProxyCommand]::Create((New-Object System.Management.Automation.CommandMetaData $Commands)) } catch { } } else { ‘’ }

Error executing PowerShell: Exception calling “InvokeCommand” with “1” argument(s): “Timed out waiting on runspace scheduler.”

Executing command: Get-Module -ListAvailable

Scheduling command for main runspace: Get-Content (Get-PSReadLineOption).HistorySavePath

Error executing PowerShell: Exception calling “InvokeCommand” with “1” argument(s): “Timed out waiting on runspace scheduler.”

Scheduling command for main runspace: [PowerShellToolsPro.VSCode.TreeViewService]::Instance.GetTreeViews() | ConvertTo-Json -WarningAction SilentlyContinue

Error executing PowerShell: Exception calling “InvokeCommand” with “1” argument(s): “Timed out waiting on runspace scheduler.”

Exception running command: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

—> System.InvalidOperationException: Sequence contains no elements

at System.Linq.ThrowHelper.ThrowNoElementsException()

at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)

at PowerShellToolsPro.PoshToolsServer.GetTreeViews() in D:\a\1\s\PowerShellProTools.Host\PoshToolsServer.cs:line 803

— End of inner exception stack trace —

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at PowerShellToolsPro.PoshToolsServer.Start(String pipeName) in D:\a\1\s\PowerShellProTools.Host\PoshToolsServer.cs:line 97

Executing command: [PowerShellToolsPro.Cmdlets.VSCode.PSAssembly]::GetAssemblies()

Scheduling command for main runspace: Get-PSSession | ForEach-Object { [PowerShellToolsPro.Cmdlets.VSCode.Session]$_ } | ConvertTo-Json -WarningAction SilentlyContinue

Error executing PowerShell: Exception calling “InvokeCommand” with “1” argument(s): “Timed out waiting on runspace scheduler.”

Exception running command: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

—> System.InvalidOperationException: Sequence contains no elements

at System.Linq.ThrowHelper.ThrowNoElementsException()

at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)

at PowerShellToolsPro.PoshToolsServer.GetSessions() in D:\a\1\s\PowerShellProTools.Host\PoshToolsServer.cs:line 831

— End of inner exception stack trace —

at System.Runti

meMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at PowerShellToolsPro.PoshToolsServer.Start(String pipeName) in D:\a\1\s\PowerShellProTools.Host\PoshToolsServer.cs:line 97

Scheduling command for main runspace: Get-Variable | Out-PoshToolsVariable -PassThru | ConvertTo-Json -Depth 1 -WarningAction SilentlyContinue

I should also add that the ps1 script i am trying to package works fine when run without packaging. I have tried uninstalling and reinstalling poshpro in vscode without success also.

Can you share any of your script? I’d be curious what part of it is crashing.

As for the extension, it looks like it’s failing to connect to the main PS process. It looks like it’s trying to issue commands before it’s connected and causing a problem. I’ll try to reproduce this.

Scheduling command for main runspace: $Commands = Get-Command ‘Set-Variable’ -ErrorAction SilentlyContinue; if ($Commands) { try { [System.Management.Automation.ProxyCommand]::Create((New-Object System.Management.Automation.CommandMetaData $Commands)) } catch { } } else { ‘’ }

Error executing PowerShell: Exception calling “InvokeCommand” with “1” argument(s): “Timed out waiting on runspace scheduler.”

Let me know where to send it. Because I had to collapse it all into a single PS1 to get it to package at all its a bit long for a PS1.

I was also under the impression that support for the private edition (since im not a business) was community support only so I greatly appreciate the offer to email support. Just let me know what you need and I will gladly provide it. I think POSHPRO is one of the best tools I have used to date. The offer for a remote session to make your troubleshooting easier is also open.

Crash is not a issue anymore. Had some issues with the form editor leaving traces of the original button and label names after i renamed them in the form editor and once i fixed those the crashing stopped.