KEMBAR78
DefaultCommandPrefix from Module PSD ignored after recent patch · Issue #25419 · PowerShell/PowerShell · GitHub
Skip to content

DefaultCommandPrefix from Module PSD ignored after recent patch #25419

@totkeks

Description

@totkeks

Prerequisites

Steps to reproduce

  • Import a PowerShell module with a DefaultCommandPrefix set in the .psd file
  • As an example, use my module totkeks.GitManagement from PowerShell gallery
  • Run command Set-GitBaseDirectory

Source of the error from this PR #20409 (comment), where it is not checking for String.IsNullOrEmpty() anymore, instead using just null coalescing ??, which doesn't include String.Empty.

Expected behavior

* Commands are prefixed with the defined prefix, e.g. `Git`, and are working / found in the current scope

Actual behavior

* Command not found, because the prefix was overwritten with an empty string

Error details

Environment data

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.6.0-preview.4
PSEdition                      Core
GitCommitId                    7.6.0-preview.4
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    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