JiraPS icon indicating copy to clipboard operation
JiraPS copied to clipboard

Invoke-JiraMethod - Add-Member : Cannot add a member with the name "toString" because a member with that name already exists.

Open hkelley opened this issue 1 year ago • 1 comments

Description

When using Invoke-JiraMethod -URI $uri with PSVersion 5.1, the following error is thrown:

Add-Member : Cannot add a member with the name "toString" because a member with that name already exists. To overwrite the member anyway, add the Force parameter to your command.

This seems to correspond to this line: https://github.com/AtlassianPS/JiraPS/blob/109dc3499ea08e1575ec328cbe7b15cdec258b96/JiraPS/Private/ConvertFrom-Json.ps1#L39

Steps To Reproduce

  1. Run this cmdlet
`Invoke-JiraMethod -URI $uri `

Expected behavior

No warning messages

Screenshots

image

Your Environment

Get-Module JiraPS -ListAvailable | Select Name, Version
$PSVersionTable

Name                      Version
----                      -------
JiraPS                    2.14.7 
JiraPS                    2.14.6 
PSVersion                        
PSEdition                        
PSCompatibleVersions             
BuildVersion                     
CLRVersion                       
WSManStackVersion                
PSRemotingProtocolVersion        
SerializationVersion       

Possible Solution

Add the -force option

hkelley avatar Jan 02 '24 21:01 hkelley

I would love to see this addressed as well. It hurts when retrieving Jira entities that contain "toString" as the field name, such as with Status fields.

GeekTieGuy avatar Aug 13 '25 00:08 GeekTieGuy