I am totally confused at why this is happening.
The powershell script below works fine when I run it as is:
$test=New-Object IO.MemoryStream(,[Convert]