Skip to content

Binary modules that worked in PowerShell 6 may not work in 7 #11053

@KirkMunro

Description

@KirkMunro

@iSazonov and @SteveL-MSFT I think we made a mistake by removing the WorkflowInfo type in PR #9638. I know PR #6708 changed the type from public to internal, and that was probably a mistake as well.

I was just testing my FormatPx module in PowerShell 7, since Out-Printer is now added back into PowerShell, but the module won't load. It fails with the following error:

Import-Module: Could not load type 'System.Management.Automation.WorkflowInfo' from assembly 'System.Management.Automation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

I get the same error if I try to import DebugPx into PowerShell 7, but DebugPx loads just fine in PowerShell 6.2 (FormatPx does not, because there is no Out-Printer command, and it derives its Out-Printer proxy from that command).

Both DebugPx and FormatPx have binary modules as part of their package.

I am not referencing WorkflowInfo directly from either of those projects, so that error must be coming from the PowerShell components that I do reference.

Testing this out locally, I have found that if I put an empty public WorkflowInfo class back in PowerShell 7 (not derived from anything, with no constructors or members), suddenly my DebugPx module loads fine again.

FormatPx loads as well, but doesn't work (null reference exception somewhere), but so I need to figure that one out. That issue aside, it seems we need the WorkflowInfo class to persist for backwards compatibility support. Mind if I put it back in a PR?

Steps to reproduce

Install-Module DebugPx
Import-Module DebugPx

Expected behavior

The module should load without error.

Actual behavior

Import-Module: Could not load type 'System.Management.Automation.WorkflowInfo' from assembly 'System.Management.Automation, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.5
PSEdition                      Core
GitCommitId                    7.0.0-preview.5-64-ge185f89591ac5fa5286bef60d087d852873df2be
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Maintainers-Buildspecific to affecting the buildIssue-BugIssue has been identified as a bug in the productResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.WG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions