Skip to content

Major module loading problems in beta 9 #5232

@Jaykul

Description

@Jaykul

If I modify the PSModulePath, it causes errors on practically every module load.

Steps to reproduce

pwsh -noprofile

# Add a new, folder to the PSModulePath. This one is empty. It doesn't have to be.
$Env:PSModulePath += ";" + $(mkdir TestModules | cvpa)

# Try to import a module that's already imported 
import-module Microsoft.PowerShell.Management

# Try to import a new module
import-module Microsoft.PowerShell.Diagnostics

# List the imported modules:
Get-Module

Expected behavior

Silent success

Actual behavior

No matter what module you load, you get an error message. For instance:

import-module : The specified module 'Microsoft.PowerShell.Management' was not loaded because no valid module file was
found in any module directory.
At line:1 char:1
+ import-module Microsoft.PowerShell.Management
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (Microsoft.PowerShell.Management:String) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Note: the module is loaded, but the error message indicates that it was not. This applies to modules that were already loaded as well as importing new modules -- you get a big error, but it appears that the module import is actually working behind the scenes: Get0Mo

Environment data

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.9
PSEdition                      Core
GitCommitId                    v6.0.0-beta.9
OS                             Microsoft Windows 10.0.15063
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

Labels

Resolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions