Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using with PowerShell.Create PowerShellLogging throws on all Write Output #6

Closed
Jaykul opened this issue Jun 28, 2019 · 1 comment · Fixed by #7
Closed

When using with PowerShell.Create PowerShellLogging throws on all Write Output #6

Jaykul opened this issue Jun 28, 2019 · 1 comment · Fixed by #7

Comments

@Jaykul
Copy link

Jaykul commented Jun 28, 2019

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
@dlwyatt
Copy link
Owner

dlwyatt commented Jun 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants