Yeah. Wrapping sqlpackage.exe, I would get the above CLR error, and sometimes Out of Memory, and sometimes success. I'm specifically wrapping a 32-bit sqlpackage.exe, but I don't know which "plugin" settings below ultimately applies to the process, which I start via Start-Process.
I'm having a long run of successes presently, so I think this last thing I tried may have been the fix.
I raised memory per shell up to a few gigs, both on the top level, and in each plugin:
cd WSMan:\localhost\Shell
Set-Item .\MaxConcurrentUsers 25
Set-Item .\MaxMemoryPerShellMB 4096
cd WSMan:\localhost\Plugin\microsoft.powershell\Quotas
Set-Item .\MaxConcurrentCommandsPerShell 4096
Set-Item .\MaxConcurrentUsers 25
Set-Item .\MaxMemoryPerShellMB 4096
cd WSMan:\localhost\Plugin\microsoft.powershell32\Quotas
Set-Item .\MaxConcurrentCommandsPerShell 4096
Set-Item .\MaxConcurrentUsers 25
Set-Item .\MaxMemoryPerShellMB 4096
Restart-Service winrm
-Nik