Inappropriate references to ushort type in New-DkimSigningConfig and Rotate-DkimSigningConfig.

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
powershell
領域
backend

調査の方向性

Find the definitions of New-DkimSigningConfig and Rotate-DkimSigningConfig in the ExchangeOnlineManagement module and inspect their KeySize parameter types. Check how similar parameters are typed elsewhere in the module, then verify that both commands can be called under Windows PowerShell 5.1. Done means neither function fails with a type lookup error.

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

説明

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Steps to reproduce

According to the documentation, for the ExchangeOnlineManagement module:

"All versions of the module are supported in Windows PowerShell 5.1."

Yet, since 3.5.0, two functions have declared parameters using the [ushort] type, which does not exist in the .NET Framework, causing both functions to fail under Windows PowerShell with the "unable to find type [ushort]" error. The issue still exists in 3.6.0.

This is not an issue under PowerShell (as distinct from Windows PowerShell) where an additional library declares the ushort type (system.private.corelib).

Example from New-DkimSigningConfig showing inappropriate ushort declaration for KeySize parameter:

`function script:New-DkimSigningConfig
{
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')]
param(

[string]
${AdminDisplayName},

${BodyCanonicalization},

[Parameter(Mandatory=$true, Position=0)]
${DomainName},

[Parameter(Mandatory=$true, Position=1)]
[bool]
${Enabled},

${HeaderCanonicalization},

[ValidateSet('1024','2048')]
[ushort]
${KeySize}
)

`

Expected behavior
That the commands declare the "KeySize" parameter using either [uint16] (if for some reason it must be a 16-bit value) or - in line with the rest of the module's functions - [uint32] (which to my mind would be more consistent).

This would resolve the type exception while maintaining compatibility on Windows PowerShell.
Actual behavior
Under Windows PowerShell, calls to both New-DkimSigningConfig and Rotate-DkimSigningConfig fail immediately (before function entry) on account of the ushort type not existing, as shown in the screenshot.
Error details
Unable to find type [ushort].
At C:\Users\lain.robertson\AppData\Local\Temp\tmpEXO_faj3kift.kut\tmpEXO_faj3kift.kut.psm1:25026 char:5
+     [ushort]
+     ~~~~~~~~
    + CategoryInfo          : InvalidOperation: (ushort:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
Environment data
PS D:\Data> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.4894
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4894
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Version

3.6.0

Visuals

image

主要言語
PowerShell
スター
289
フォーク
83
平均マージ
1分
マージ済み PR(30日)
1

環境構築

はじめの一歩

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

PowerShell/PowerShellGallery のほかの issue

PowerShell/PowerShellGallery の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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