ILSpy on the latest release:
https://www.nuget.org/packages/System.Management.Automation/
shows RunspaceInvoke missing
References:
/cc @JamesWTruher
Hmm, the RunspaceInvoke.cs was not included in the build, since 6.0 ... See https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/System.Management.Automation.csproj#L102
I don't see an obvious reason to exclude it. Maybe it should be brought back.
/cc @adityapatwardhan @TravisEz13 @rjmholt
GitHub
PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
I don't see the harm, beyond confusing the API a bit with an alternative to PowerShell.Create().AddScript(...).Invoke(). Does this do anything different?
It has some APIs which take a string and and execute them. That's not the safest thing to do, but I'm pretty sure we have similar APIs
@Triggs9 How did you find it missing? Did you try to migrate old code to PowerShell 7 and found it broken because of this?
I feel I should mention that this not being in PS 7.0 (and also PSStd) does devalue adding it back in now a bit
No i was trying to run something from the current powershell runspace instead of in a sub powershell instance. I was able to get it working by using an old library that had it included. So i thought i would bring it up, but then abandoned that approach in favor of using just $ExecutionContext.InvokeCommand.InvokeScript()
You can also try PowerShell.Create(RunspaceMode.CurrentRunspace)
You can also try
PowerShell.Create(RunspaceMode.CurrentRunspace)
@rjmholt Thanks, I've actually been using this in all situations now.
@PowerShell/powershell-maintainers maintainers reviewed this issue and decided to not bring this type back given that
Most helpful comment
You can also try
PowerShell.Create(RunspaceMode.CurrentRunspace)