Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

New-CommandHelp throws error when using strict mode

Aperta
#800 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@adityapatwardhan ci sta già lavorando.

Dal 19/8/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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

I default to strict mode and noticed that New-CommandHelp does not work with that configuration.
Repro steps:


function Get-Foo {'foo'}
Set-StrictMode -Version Latest
Get-Command Get-Foo | New-CommandHelp # this fails

Expected behavior
`New-CommandHelp` should work in strict mode or the limitation should be documented. The workaround to disable strict mode is straightforward, but it took me some time to figure out it was the culprit.
Actual behavior
It fails with error:

New-CommandHelp: The property 'relatedLinks' cannot be found on this object. Verify that the property exists.
Error details
Exception             :
    Type        : System.Management.Automation.PropertyNotFoundException
    ErrorRecord :
        Exception             :
            Type    : System.Management.Automation.ParentContainsErrorRecordException
            Message : The property 'relatedLinks' cannot be found on this object. Verify that the property exists.
            HResult : -2146233087
        CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : PropertyNotFoundStrict
    TargetSite  :
        Name          : GetAdaptedValue
        DeclaringType : [System.Management.Automation.Language.PSGetMemberBinder]
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message     : The property 'relatedLinks' cannot be found on this object. Verify that the property exists.
    Source      : System.Management.Automation
    HResult     : -2146233087
    StackTrace  :
   at System.Management.Automation.Language.PSGetMemberBinder.GetAdaptedValue(Object obj, String member)
   at CallSite.Target(Closure, CallSite, Object)
   at Microsoft.PowerShell.PlatyPS.TransformBase.GetRelatedLinks(Object helpItem)
   at Microsoft.PowerShell.PlatyPS.TransformBase.ConvertCmdletInfo(CommandInfo commandInfo)
   at Microsoft.PowerShell.PlatyPS.TransformCommand.Transform(CommandInfo command)
   at Microsoft.PowerShell.PlatyPS.TransformCommand.Transform(IEnumerable`1 command)
   at Microsoft.PowerShell.PlatyPS.NewCommandHelpCommand.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo          : NotSpecified: (:) [New-CommandHelp], PropertyNotFoundException
FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PlatyPS.NewCommandHelpCommand
InvocationInfo        :
    MyCommand        : New-CommandHelp
    ScriptLineNumber : 1
    OffsetInLine     : 23
    HistoryId        : 4
    Line             : Get-Command Get-Foo | New-CommandHelp
    Statement        : New-CommandHelp
    PositionMessage  : At line:1 char:23
                       + Get-Command Get-Foo | New-CommandHelp
                       +                       ~~~~~~~~~~~~~~~
    InvocationName   : New-CommandHelp
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
Environment data
Name                           Value
----                           -----
PSVersion                      7.5.2
PSEdition                      Core
GitCommitId                    7.5.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Version

1.0.1

Visuals

No response

Lingua principale
C#
Stelle
870
Fork
166
Merge medio
21h 17m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PowerShell/platyPS

Tutte le issue di PowerShell/platyPS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.