You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When using with PowerShell.Create PowerShellLogging throws on all Write Output #6
We're using this module in some of our modules, and now someone's tried to call our module from C# with a PowerShell.Create (no host).
We expected the logs would still show up, but instead PowerShellLogging throws on any output.
A quick review of source shows that (almost) all the output methods are deliberately throwing when the host is null (as it is, presumably, in the case where we're using PowerShell.Create).
Proposal: (I will implement, if you're OK with this). I think that simply changing the methods to use the null check just to skip calling the host (rather than throwing) would:
On Jun 28, 2019, at 10:57 AM, Joel Bennett ***@***.***> wrote:
We're using this module in some of our modules, and now someone's tried to call our module from C# with a PowerShell.Create (no host).
We expected the logs would still show up, but instead PowerShellLogging throws on any output.
A quick review of source shows that (almost) all the output methods are deliberately throwing when the host is null (as it is, presumably, in the case where we're using PowerShell.Create).
Proposal: (I will implement, if you're OK with this). I think that simply changing the methods to use the null check just to skip calling the host (rather than throwing) would:
Avoid breaking PowerShell when there's no host
Allow logging even when there's no a host
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Activity
dlwyatt commentedon Jun 28, 2019