Graphite-PowerShell-Functions icon indicating copy to clipboard operation
Graphite-PowerShell-Functions copied to clipboard

Various Module Issues

Open AGirin opened this issue 10 years ago • 2 comments

Thanks a lot for a great project! I found some issues with it though:

--> I was getting no such method Dispose() on Windows 2008 with PowerShell 2.0 installed here:

function PSUsing { param ( [System.IDisposable] $inputObject = $(throw "The parameter -inputObject is required."), [ScriptBlock] $scriptBlock = $(throw "The parameter -scriptBlock is required.") ) Try { &$scriptBlock } Finally { if ($inputObject -ne $null) { if ($inputObject.psbase -eq $null) { $inputObject.Dispose() } else { $inputObject.psbase.Dispose() <-------- No such method psbase.Dispose() in PowerShell 2.0 } } } }

I had to comment that line out to make module work.

--> Module was erroring on that line with PowerShell 2.0:

RootModule = 'Graphite-Powershell.psm1'

I had to replace it with:

ModuleToProcess = 'Graphite-Powershell.psm1'

All these issues go away if I upgrade to PowerShell 3.0 though.

AGirin avatar Nov 19 '14 22:11 AGirin

Others are commenting on the powershell version too, looks like this project requires 3.0 ... good reason to upgrade.

kasperbrandenburg avatar May 10 '15 19:05 kasperbrandenburg

seems to be related to the implementation of PSUsing and invocations of Dispose() https://davewyatt.wordpress.com/2014/05/27/idisposable-and-powershell-versions/ Something more portable would be nice.

jdevoo avatar Jul 13 '15 12:07 jdevoo