BUG: PowerShell workflow execution hang when using PSObject parameter in a new PowerShell session

One upon a time... I was playing with PowerShell workflows to automate stuff in Azure.

The scripts were doing what I wanted them to, but the day after I started to have problems when trying to execute them again.

After an hour of trials and errors, I discovered that if I have a parameter type declared in a workflow, in my case it was [PSObject], the execution hung to never come back... and I mean never.

Non working snippet

$VerbosePreference = 'Continue'

workflow Test-ScaleInfo {
    param(
    	[PSObject]
        $ScaleInfo
    )
    Write-Verbose 'Hello world'
}

@{Test='adasdd'} | Test-ScaleInfo

Working snippet

$VerbosePreference = 'Continue'

workflow Test-ScaleInfo {
    param(
        $ScaleInfo
    )
    Write-Verbose 'Hello world'
}

@{Test='adasdd'} | Test-ScaleInfo

One thing that let me think it might be an initialization issue... if I take the working snippet and execute it in a new PowerShell session before executing the non working snippet, the non working snippet will now work.

Workaround

What will work until this is fixed? Simply remove the type declaration from your parameter.

A bug have been opened on Microsoft Connect for this issue.
Bug#1203243 on Microsoft Connect