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
Alternatively if throwing is a design choice, throw an ArgumentException instead of letting Enumerable.Last fail.
Actual behavior
> [System.Management.Automation.CommandCompletion]::CompleteInput('', 0, @{})
Exception calling "CompleteInput" with "3" argument(s): "Sequence contains no elements"
At line:1 char:1
+ [System.Management.Automation.CommandCompletion]::CompleteInput('', 0 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
> $Error[0].Exception.InnerException | Format-List * -Force
Message : Sequence contains no elements
Data : {}
InnerException :
TargetSite : TSource Last[TSource](System.Collections.Generic.IEnumerable`1[TSource])
StackTrace : at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
at
System.Management.Automation.CompletionAnalysis.InitializeCompletionContext(TypeInferenceContext
typeInferenceContext)
at System.Management.Automation.CompletionAnalysis.GetResults(PowerShell powerShell, Int32&
replacementIndex, Int32& replacementLength)
at System.Management.Automation.CommandCompletion.CompleteInputImpl(Ast ast, Token[] tokens,
IScriptPosition positionOfCursor, Hashtable options)
at System.Management.Automation.CommandCompletion.CompleteInput(String input, Int32 cursorIndex,
Hashtable options)
at CallSite.Target(Closure , CallSite , Type , String , Int32 , Hashtable )
HelpLink :
Source : System.Linq
HResult : -2146233079
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.0.0-rc.2
PSEdition Core
GitCommitId v6.0.0-rc.2
OS Microsoft Windows 10.0.15063
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Steps to reproduce
Or
Expected behavior
Alternatively if throwing is a design choice, throw an
ArgumentExceptioninstead of lettingEnumerable.Lastfail.Actual behavior
Environment data