New-CommandHelp throws error when using strict mode
@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
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PowerShell/platyPS
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PowerShell/platyPS#857 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
PowerShell/platyPS#863 ·
-
Export-MamlCommandHelp: a module file in the batch aborts the whole export and writes nothingAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
PowerShell/platyPS#862 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
PowerShell/platyPS#861 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
PowerShell/platyPS#860 · 1 commento ·
Tutte le issue di PowerShell/platyPS
Issue simili
-
affected/v17 affected/v18 area/frontend type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
umbraco/Umbraco-CMS#24186 ·
I maintainer di solito rispondono entro 2 giorni
-
.NET Azure Functions Docs OpenTelemetry
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
getsentry/sentry-dotnet#5715 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
AssignTargetPath does not recognize forward slashes in relative path specifiersForse già presa @AustinAviv l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 2 giorni
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Fallout-build/Fallout#708 ·
I maintainer di solito rispondono entro 5 giorni