Skip to content

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

Closed

Description

@Jaykul

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

Activity

  1. dlwyatt commented on Jun 28, 2019

    @dlwyatt
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions