Skip to content

Test-ModuleManifest needs specific error messages #6683

Closed

Description

Follow-up from #6676:

A single catch-all error is currently reported for problems relating to a module manifest's nonempty RootModule entry:

The unhelpful current error message:

Test-ModuleManifest : The module manifest 'foo.psd1' could not be processed because it is not a valid PowerShell module manifest file. Remove the elements that are not permitted: /path/to/foo.psd1

It's probably worth checking if all error scenarios have specific, helpful error messages.

Additionally, the behavior regarding requiring the extension to be specified may have changed compared to Windows PowerShell.

Environment data

PowerShell Core v6.0.2 on macOS 10.13.4
PowerShell Core v6.0.2 on Ubuntu 16.04.4 LTS
PowerShell Core v6.0.2 on Microsoft Windows 10 Pro (64-bit; Version 1709, OS Build: 16299.371)

Activity

  1. added
    Issue-Enhancementthe issue is more of a feature request than a bug
    Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributors
    on Apr 20, 2018
  2. Persistent13 commented on Oct 2, 2018

    @Persistent13

    Steve Lee (@SteveL-MSFT) Michael Klement (@mklement0) I'd like to tackle this if there is no prior work in progress.

  3. SteveL-MSFT commented on Oct 2, 2018

    @SteveL-MSFT
    Member

    Dakota Clark (@Persistent13) consider it yours! Thanks!

  4. jzabroski commented on Dec 3, 2018

    @jzabroski

    Dakota Clark (@Persistent13)
    Just to repeat what I said in #6818 :

    This block of code in the PowerShell engine needs to be removed or refactored before you can 100% eliminate any bugs in Test-ModuleManifest.

    if (found)
    {
    // Cache the module's exported commands after importing it, or if the -Refresh flag is used on "Get-Module -List"
    if ((module != null) && !module.HadErrorsLoading)
    {
    AnalysisCache.CacheModuleExports(module, Context);
    }
    }

    The problem is that, at least 3 years ago (per Blame), an engineer added a caching service to avoid re-loading modules that have already been seen in the same session. This caching service is vulnerable to attack, as explained by me and summarized in #6818

  5. Persistent13 commented on Dec 5, 2018

    @Persistent13

    John Zabroski (@jzabroski) That's for bringing that to may attention! I'll see what I can do about it.

  6. mklement0 commented on Dec 5, 2018

    @mklement0
    ContributorAuthor

    Dakota Clark (@Persistent13): Please also note the updates to my initial post, which now indicate dependencies on other issues.

  7. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  8. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  9. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  10. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

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

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions