Debug-Runspace Not Providing a Shell for Dashboards

Product: PowerShell Universal
Version: 3.7.14

I’ve been trying to use debugging in PowerShell Universal but have ran into a roadblock. I use Wait-Debugger on my dashboard page, and have it show me the process and runspace IDs so I can use Enter-PSHostProcess and Debug-Runspace. The debugging console feature in the platform admin does work, but is less than ideal. When I enter the process and try to debug the runspace I get no interactive debugger; it’s almost as if the terminal hangs until I press Ctrl+C.

Here is my page code:

New-UDPage -Name 'DebugTest' -Content {
    Wait-PUDDebugger -DebuggerRole 'Administrator' -MessagePrefix 'Test: ' | Out-Null

Here is my Wait-PUDDebugger function:

function Wait-PUDDebugger {
	param (
	$UserDebuggerRole = $null
	$UserDebuggerRole = $Roles | Where-Object -FilterScript { $_ -in $DebuggerRole }
	if ($null -ne $UserDebuggerRole) {
		$DebugPreference = 'Continue'
		$TextForDebug = "$MessagePrefix IN DEBUG MODE: Use 'Enter-PSHostProcess -Id $PID' then 'Debug-Runspace -Id $(([runspace]::DefaultRunspace).Id)'"
		Write-Debug $TextForDebug
		Show-UDModal -Content {
			New-UDHeading -Text $TextForDebug
	} else {

That shows a modal with the information that I need to enter the session and debug the runspace.

Running Debug-Runspace -ID $RunspaceID presents the following with no opportunity to interact:

I do not have this problem if I create my own runspaces like so:

function Start-Runspace {
	param (
	Write-Host "Start-Runspace: Process ID is $PID"
	$Runspace = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
	$Powershell = [System.Management.Automation.PowerShell]::Create()
	$Powershell.Runspace = $Runspace
	if ($WaitDebugger -eq $true) {
		$Powershell.AddScript('Wait-Debugger').InvokeAsync() | Out-Null
	Write-Host "Start-Runspace: Runspace ID is $($Runspace.ID)"

I don’t typically run PSU as my own user account, I typically use a service account, and use Enter-PSSession to remotely get into the same machine and user context as the PSU service. But for this test, because it’s not working, I’m running my console under the same user account as I’m running PSU.

Am I doing something wrong? I’ve also tried using VSCode and launch.json to attach to the process and runspace, and it attaches to the process and runspace but also does not interact properly.

P.S. On a slightly related note, I’d also love to know, if it’s possible, how to set up the $Cache variables that dashboards have access to in a runspace that I create in the integrated process. I’m aware of Get-PSUCache but we are using the $Cache variable scope extensively and it would be a huge change at this point. The alternative to this is I will set up a dashboard page that is just for me to cause a breakpoint and get at the $Cache in a terminal. This is for me to step into scripts and functions while I’m doing development.