-
Notifications
You must be signed in to change notification settings - Fork 32
SafeGetValue() method not available in PSv4 #34
Description
The Get-TestFromScript
function uses the method call SafeGetValue()
against [AST]
types. This method does not appear to be available in PSv4 consoles. I also don't see the need to call this method for the logic being performed.
Current Behavior
Method invocation failed because [System.Management.Automation.Language.ArrayLiteralAst] does not contain a method named 'SafeGetValue'.
Possible Solution
Extract tags with $tagElements.Elements.Value
, instead of $tagElements.SafeGetValue()
Operation-Validation-Framework/OperationValidation/Private/Get-TestFromScript.ps1
Line 43 in 0bc93ef
$item.Tags = $tagElements.SafeGetValue() |
Operation-Validation-Framework/OperationValidation/Private/Get-TestFromScript.ps1
Line 48 in 0bc93ef
$item.Tags = @($tagElements.SafeGetValue()) |
Steps to Reproduce (for bugs)
- Build an OVF module with a Simple or Comprehensive test .ps1
- Add a tag or multiple tags to the Describe's
-Tag
parameter - Make the module discoverable by PSModulePath
- In a Powershell v4 console, execute the following command:
Get-OperationValidation
Output:
Method invocation failed because [System.Management.Automation.Language.ArrayLiteralAst] does not contain a method
named 'SafeGetValue'.
At C:\Program Files\WindowsPowerShell\Modules\OperationValidation\Private\Get-TestFromScript.ps1:48 char:21
+ $item.Tags = $tagElements.SafeGetValue()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Context
Attempting to write and use OVF modules in my server environment, and do not currently have PSv5.1 installed.
Your Environment
- Module version used: 1.1.0
- Operating System and PowerShell version: Windows Server 2008 R2 Datacenter