Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

SafeGetValue() method not available in PSv4 #34

Open
@bwright86

Description

@bwright86

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()


Steps to Reproduce (for bugs)

  1. Build an OVF module with a Simple or Comprehensive test .ps1
  2. Add a tag or multiple tags to the Describe's -Tag parameter
  3. Make the module discoverable by PSModulePath
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions