-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of moduleshosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules
Description
I have an asp.net core application that uses out of process PowerShell.
Steps to reproduce
Create a project with the following code:
using System;
using System.Management.Automation.Runspaces;
PowerShellProcessInstance instance = new PowerShellProcessInstance(
powerShellVersion: new Version(5, 1),
credential: null,
initializationScript: null,
useWow64: false
);
var runspace = RunspaceFactory.CreateOutOfProcessRunspace(null, instance);
runspace.Open();<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="system.management.automation" Version="7.0.3" />
</ItemGroup>
</Project>Note, also happens w ith System.Management.Automation 7.1.0 (most recent rc)
Expected behavior
Runspace opens properly.
Actual behavior
An exception is raised:
An error has occurred which PowerShell cannot handle. A remote session might have ended.
Inner exception:
BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
Additional details
- The issue does not occur when using the default project sdk (not the web one)
- BinaryFormatter should probably not be used, see BinaryFormatter long-term obsoletion plan dotnet/designs#141
Metadata
Metadata
Assignees
Labels
Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aWG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of moduleshosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules