You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get-IshUser fails with 'Item has already been added. Key in dictionary: 'None' Key being added: 'None'' when running in parallel in StringEnum::GetStringValue
#134
Closed
jlaridon opened this issue
Sep 17, 2021
· 2 comments
Message: "Item has already been added. Key in dictionary: 'None' Key being added: 'None'"
StackTrace:
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)\r\n
at System.Collections.Hashtable.Add(Object key, Object value)\r\n
at Trisoft.ISHRemote.HelperClasses.StringEnum.GetStringValue(Enum value)\r\n
at Trisoft.ISHRemote.Objects.Public.IshField.GetXml(XmlWriter& xmlWriter)\r\n
at Trisoft.ISHRemote.Objects.IshFields.GetXml(XmlWriter& xmlWriter)\r\n
at Trisoft.ISHRemote.Objects.IshFields.ToXml()\r\n
at Trisoft.ISHRemote.Cmdlets.User.GetIshUser.ProcessRecord()
The text was updated successfully, but these errors were encountered:
Typically PowerShell is not multi-threaded unless you force it over Runspaces. In turn most of ISHRemote is thread-safe as cmdlets retrieve all their parameters from the outside. However, IshSession creation which is lean in the beginning, but as you ask/use it more it will keep a cache copy of the retrieved information. This issue is one of those, there is a static hashtable to speed up enum-conversion that happens numerously per cmdlet/API-call. The hashtable is created as we go by adding to it through StringEnum::GetStringValue
So either remove the (theoretical speedup) by removing the hashtable. Or make the hashtable threadsafe.
ddemeyer
changed the title
Get-IshUser fails when running in parallel
Get-IshUser fails with 'Item has already been added. Key in dictionary: 'None' Key being added: 'None'' when running in parallel in StringEnum::GetStringValue
Sep 20, 2021
When running following script multiple times in parallel
following error can occur
The text was updated successfully, but these errors were encountered: