Search

Parser create a false error : An empty pipe element is not allowed. by Dardenne Laurent

Active

1
0
Sign in
to vote
Type: Bug
ID: 780053
Opened: 2/26/2013 12:27:05 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
The error number is different depending on the construction of an instruction.
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

Yes, this happens in all previous versions
Reproduction Steps
$Error.Clear()
Dir | Foreach-Object { $_ }
$Error.Count
#0
$Error.Clear()

Dir |
Foreach-Object { $_ }
$Error.Count
#1

$error|select *

# Errors                     :
# Message                     : Un élément de canal vide n'est pas autorisé.
# ErrorRecord                 : Un élément de canal vide n'est pas autorisé.
# StackTrace                 :    à System.Management.Automation.AutomationEngine.ParseScriptBlock(String script,
#                             String fileName, Boolean interactiveCommand)
#                                 à
#                             System.Management.Automation.Runspaces.Command.CreateCommandProcessor(ExecutionContext
#                             executionContext, CommandFactory commandFactory, Boolean addToHistory, CommandOrigin
#                             origin)
#                                 à System.Management.Automation.Runspaces.LocalPipeline.CreatePipelineProcessor()
#                                 à System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
#                                 à System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
# WasThrownFromThrowStatement : False
# Data                        : {}
# InnerException             :
# TargetSite                 : System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject]
#                             Invoke(System.Collections.IEnumerable)
# HelpLink                    :
# Source                     : System.Management.Automation
# HResult                     : -21462330
Expected Results
Error.Clear()
Dir | Foreach-Object { $_ }
$Error.Count
#0
$Error.Clear()

Dir |
Foreach-Object { $_ }
$Error.Count
#0
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.