Skip to content

Test-ModuleManifest does not populate the NestedModules field #7833

@maddieclayton

Description

@maddieclayton

When I run the Test-ModuleManifest cmdlet with a psd1 file that has a NestedModules field, it returns null for NestedModules (even though the dll exists and is in the correct location). This results in Update-ModuleManifest commenting out the existing NestedModule fields when I try to update just the version. This is causing massive issues with our versioning scripts when trying to update from PowerShell 5.1 to PowerShell 6.0. Running this in PowerShell 5.1 with the same files works as expected. When I pulled down PowerShell to try to debug this, I saw that NestedModules was set correctly here: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs#L2041, but not set in moduleInfo before moduleInfo was returned here: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs#L2800.

Steps to reproduce

$a = Test-ModuleManifest -Path <path to module with filled out nestedmodules field>
$a.NestedModule # Returns nothing

Expected behavior

$a = Test-ModuleManifest -Path <path to module with filled out nestedmodules field>
$a.NestedModule # Returns correct Nested Modules

Actual behavior

Returns nothing


Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0-preview.4
PSEdition                      Core
GitCommitId                    6.1.0-preview.4
OS                             Microsoft Windows 10.0.17134
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

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.WG-Cmdlets-Corecmdlets in the Microsoft.PowerShell.Core module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions