Skip to content

Invoking ConfigInstruction in two different runspaces cases ExceptionInGetEnumerator #11

Description

@alx9r

Repro

  1. Open ISE
  2. Invoke ConfigInstructions Name {} in the REPL
  3. Open a second REPL tab in ISE.
  4. Invoke ConfigInstructions Name {} in the second REPL tab
  5. The following error is output:
format-default : The following exception occurred while trying to enumerate the collection: "The term 'New-ProgressNodes' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.".
    + CategoryInfo          : NotSpecified: (:) [format-default], ExtendedTypeSystemException
    + FullyQualifiedErrorId : ExceptionInGetEnumerator,Microsoft.PowerShell.Commands.FormatDefaultCommand

Cause

The cause of this error seems to be PowerShell itself. When a module that implements an object that implements IEnumerator is loaded into two runspaces in the same process, then, in the second runspace no functions from the module are available from within .GetEnumerator().

There is a repro of this bug that is independent of ZeroDSC in the ToolFoundations repo.

Affected PowerShell Versions

Versions known to exhibit problem:

  • 5.0.10586.51
  • 5.0.10586.117

Versions known not to exhibit problem:

  • 5.1.14394.1000

Expected Resolution

It looks like PowerShell 5.0 has this problem but 5.1 does not. This issue should remain open until it has been confirmed that the GA version of PowerShell 5.1 indeed ships with this issue resolved.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions