镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

classes are not imported into the parallel runspaces #2

Open

Description

@powercode
class Foo {
    $I
    Foo($i){ $this.I = $i }
}

1..10 | Invoke-Parallel {[Foo]::new($_)}

Error: Invoke-Parallel : Unable to find type [Foo].

Activity

  1. Zuldan commented on May 10, 2016

    @Zuldan

    @powercode Staffan,

    Looking forward to when this class issue is resolved so we don't have to duplicate classes inside and outside of Invoke-Parallel.

  2. vors commented on May 10, 2016

    @vors
    Contributor

    Classes scopes and life-cycles are not exposed properly. Unfortunately. It may be pretty hard to support it for PS v5 and most likely support would use non-public APIs. @dlwyatt hit similar problem with implementing mocking for PS classes in pester.

    I'd like to collect info from community to understand how to expose classes scopes and lifecycle management properly and maybe write an RFC for it. Please, feel free to contact me with sevoroby@microsoft.com and describe problems you faced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions