PowerShell / PowerShell/PSResourceGet

Update-ModuleManifest corrupts PrivateData in module manifest

オープン
#307 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area-InfoFile Issue-Bug
主要言語
C#
スター
576
フォーク
114
平均マージ
1日 2時間
マージ済み PR(30日)
7

説明

This bug by @jformacek is copied from https://github.com/MicrosoftDocs/PowerShell-Docs/issues/6767

Usage of this command on existing module manifest breaks it's content. I wanted to use this command inside build pipeline to update ModuleVersion attribute, but found at least 2 things that got broken on my manifest module:

  • RequiredAssembles attribute: I have something like below in my manifest file, and Update-ModuleManifest removes this attribute completely
RequiredAssemblies = if($PSEdition -eq 'Desktop') {@('lib\net45\someAssembly.dll')} else {$null}
  • PrivateData attribute: I have added additional content as hashtable Messages to module's PrivateData as addtional hashtable aside from PSData as shown below, however, Update-ModuleManifest changes the Messages hashtable to Messages = 'System.Collections.Hashtable', which breaks the logic of module
PrivateData = @{
    Messages = @{
        NotInitialized = 'Call Initialize-Module before running other cmdlets.'
    }
    PSData = @{
    # ... standard content
    }

Would be great to update the command so as it does not change the attributes that are not passed from command line, or at least document here what gets changed/reset when command is run, so as users are not surprised after running it.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Update-ModuleManifest コマンドから始め、RequiredAssemblies と入れ子になった PrivateData.Messages を含むマニフェストで報告を再現します。ModuleVersion だけを更新する前後でマニフェストを比較します。未指定の属性が、入れ子になった Messages ハッシュテーブルを含めてそのまま保持され、報告された両方のケースに対するリグレッションカバレッジがあることを完了条件とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
powershell
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。