darkoperator / darkoperator/Posh-SSH

An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute..

Open
#538 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Hi,
We were using a script with version 2.1 on a former server now we changed to a new server and installed version 3.0.8. Now with the same script we get this error. Any idea?

An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not
execute..
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\3.0.8\Posh-SSH.psm1:977 char:9

  •         $result
  •         ~~~~~~~
        + CategoryInfo          : InvalidOperation: (System.Collecti...SH.SftpSession]:Enumerator) [], RuntimeException
        + FullyQualifiedErrorId : BadEnumeration

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by reproducing the reported error with the same script on Posh-SSH 3.0.8 and inspect Posh-SSH.psm1 at line 977, comparing behavior with version 2.1 if available. Confirm the collection-enumeration failure and verify that the script completes without the BadEnumeration error after the issue is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.