You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An empty string argument in Get-Date -UFormat '' throws IndexOutOfRangeException, it would be more helpful if the error said what was wrong and directed attention to the UFormat argument. "Missing or Invalid UFormat String" or words to that effect.
Steps to reproduce
PS /test>get-date-uformat "$accidentallyEmptyFormatStringVariable"get-date : Index was outside the bounds of the array.
At line:1 char:1+get-date-uformat ''+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Date], IndexOutOfRangeException
+ FullyQualifiedErrorId : System.IndexOutOfRangeException,Microsoft.PowerShell.Commands.GetDateCommand
Expected behavior
A message directing attention to the -UFormat string parameter being empty.
Actual behavior
A message about some internal problem.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.0.0-beta.8
PSEdition Core
GitCommitId v6.0.0-beta.8
OS Linux 2.6.32-042stab120.6#1 SMP Thu Oct 27 16:59:03 MSK 2016
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
An empty string argument in
Get-Date -UFormat ''throwsIndexOutOfRangeException, it would be more helpful if the error said what was wrong and directed attention to the UFormat argument. "Missing or Invalid UFormat String" or words to that effect.Steps to reproduce
Expected behavior
Actual behavior
Environment data