PowerShell 7 - Enable-LogFile: Object reference not set to an instance of an object.
Dear All
When trying to use the module in PowerShell 7 I get the following error.
C:\> import-module PowerShellLogging
C:\> Enable-LogFile -Path "c:\temp\test.txt"
ErrorCallback Path Streams DateTimeFormat
------------- ---- ------- --------------
C:\temp\test.txt All r
Enable-LogFile: Object reference not set to an instance of an object.
Thank you very much. Marc
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
get-module -Name PowerShellLogging
ModuleType Version PreRelease Name ExportedCom
---------- ------- ---------- ---- -----------
Script 1.3.0 PowerShellLogging {Disable-Lo
After upgrading from PS 5.1 to 7.0.3 logging stopped working with the same error reported above.
Here's the stack trace:
Object reference not set to an instance of an object.
at PSLogging.HostIOInterceptor.AttachToHost(PSHost host)
at PSLogging.Commands.EnableLogFileCommand.EndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
$PSVersionTable
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 6.3.9600
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0.}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Get-Module -Name PowerShellLogging
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 1.3.0 PowerShellLogging {Disable-LogFile, Disable-OutputSubscriber, Enabl.
This has been fixed in source for a long time. You'll just have to build your own copy 😕
@Jaykul it would be nice to have a new version in the gallery.
@dlwyatt, @rbernardino When will a new version be released to PS Gallery?
I'd have to fork it, I think. Not sure I can take over someone else's module in the gallery.
Is your username just @Jaykul in psgallery? I can add you as an owner there. I haven't used or tested this thing in ages :)
Can you transfer the project to the PoshCode and add me there too, so I can deal with issues? Oh, and yes -- and the account is connected to my email at huddledmasses.org still.
You can fork the git repo, no need to move that. I just added you as an owner in psgallery so you can publish new stuff :)
feel free to update the links on psgallery to point to a new location for the project site, but I'd rather keep my old projects here. Might need the resume material someday lol.
Yeah, that's fine. I'll swap it. It's just that actual fork repos can't have issues. But I'll deal with it ;)
@Jaykul and @dlwyatt, any updates on the Source Code transfer and publication update on PS Gallery?