Skip to content

Orchestrator Should Not Throw an Exception if Output is $null #504

@michaelpeng36

Description

@michaelpeng36

In the case that the orchestrator returns a $null object, for example as in the following orchestrator:

using namespace System.Net

param($Context)

$output

it throws the following error

[7/30/2020 5:38:19 PM]
[7/30/2020 5:38:19 PM] Exception             : 
[7/30/2020 5:38:19 PM]     Type              : System.Management.Automation.ParameterBindingValidationException
[7/30/2020 5:38:19 PM]     Message           : Cannot bind argument to parameter 'InputObject' because it is null.
[7/30/2020 5:38:19 PM]     ParameterName     : InputObject
[7/30/2020 5:38:19 PM]     ParameterType     : System.Object
[7/30/2020 5:38:19 PM]     ErrorId           : ParameterArgumentValidationErrorNullNotAllowed
[7/30/2020 5:38:19 PM]     CommandInvocation : 
[7/30/2020 5:38:19 PM]         MyCommand        : Trace-PipelineObject
[7/30/2020 5:38:19 PM]         HistoryId        : 1
[7/30/2020 5:38:19 PM]         InvocationName   : Microsoft.Azure.Functions.PowerShellWorker\Trace-PipelineObject
[7/30/2020 5:38:19 PM]         PipelineLength   : 2
[7/30/2020 5:38:19 PM]         PipelinePosition : 2
[7/30/2020 5:38:19 PM]         ExpectingInput   : True
[7/30/2020 5:38:19 PM]     ErrorRecord       : 
[7/30/2020 5:38:19 PM]         Exception             : 
[7/30/2020 5:38:19 PM]             Type    : System.Management.Automation.ParentContainsErrorRecordException
[7/30/2020 5:38:19 PM]             Message : Cannot bind argument to parameter 'InputObject' because it is null.
[7/30/2020 5:38:19 PM]             HResult : -2146233087
[7/30/2020 5:38:19 PM]         CategoryInfo          : InvalidData: (:) [Trace-PipelineObject], ParentContainsErrorRecordException
[7/30/2020 5:38:19 PM]         FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Functions.PowerShellWorker.Commands.TracePipelineObjectCommand
[7/30/2020 5:38:19 PM]         InvocationInfo        : 
[7/30/2020 5:38:19 PM]             MyCommand       : Trace-PipelineObject
[7/30/2020 5:38:19 PM]             HistoryId       : 1
[7/30/2020 5:38:19 PM]             CommandOrigin   : Internal
[7/30/2020 5:38:19 PM]         ScriptStackTrace      : at <ScriptBlock>, C:\Users\t-mipeng\Documents\azure-functions-powershell-worker\examples\durable\DurableApp\HumanInteractionOrchestrator\run.ps1: line 9
[7/30/2020 5:38:19 PM]     TargetSite        : 
[7/30/2020 5:38:19 PM]         Name          : BindValueFromPipeline
[7/30/2020 5:38:19 PM]         DeclaringType : System.Management.Automation.CmdletParameterBinderController, System.Management.Automation, Version=7.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[7/30/2020 5:38:19 PM]         MemberType    : Method
[7/30/2020 5:38:19 PM]         Module        : System.Management.Automation.dll
[7/30/2020 5:38:19 PM]     StackTrace        : 
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindValueFromPipeline(PSObject inputToOperateOn, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingStateInParameterSet(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingState(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParametersPrivate(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParameters(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CommandProcessor.Read()
[7/30/2020 5:38:19 PM]     Source            : System.Management.Automation
[7/30/2020 5:38:19 PM]     HResult           : -2146233087
[7/30/2020 5:38:19 PM] CategoryInfo          : InvalidData: (:) [Trace-PipelineObject], ParameterBindingValidationException
[7/30/2020 5:38:19 PM] FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Functions.PowerShellWorker.Commands.TracePipelineObjectCommand
[7/30/2020 5:38:19 PM] InvocationInfo        : 
[7/30/2020 5:38:19 PM]     MyCommand       : Trace-PipelineObject
[7/30/2020 5:38:19 PM]     HistoryId       : 1
[7/30/2020 5:38:19 PM]     CommandOrigin   : Internal
[7/30/2020 5:38:19 PM] ScriptStackTrace      : at <ScriptBlock>, C:\Users\t-mipeng\Documents\azure-functions-powershell-worker\examples\durable\DurableApp\HumanInteractionOrchestrator\run.ps1: line 9
[7/30/2020 5:38:19 PM]
[7/30/2020 5:38:19 PM]
[7/30/2020 5:38:19 PM] Result: ERROR: Cannot bind argument to parameter 'InputObject' because it is null.
[7/30/2020 5:38:19 PM]
[7/30/2020 5:38:19 PM] Exception             : 
[7/30/2020 5:38:19 PM]     Type              : System.Management.Automation.ParameterBindingValidationException
[7/30/2020 5:38:19 PM]     Message           : Cannot bind argument to parameter 'InputObject' because it is null.
[7/30/2020 5:38:19 PM]     ParameterName     : InputObject
[7/30/2020 5:38:19 PM]     ParameterType     : System.Object
[7/30/2020 5:38:19 PM]     ErrorId           : ParameterArgumentValidationErrorNullNotAllowed
[7/30/2020 5:38:19 PM]     CommandInvocation : 
[7/30/2020 5:38:19 PM]         MyCommand        : Trace-PipelineObject
[7/30/2020 5:38:19 PM]         HistoryId        : 1
[7/30/2020 5:38:19 PM]         InvocationName   : Microsoft.Azure.Functions.PowerShellWorker\Trace-PipelineObject
[7/30/2020 5:38:19 PM]         PipelineLength   : 2
[7/30/2020 5:38:19 PM]         PipelinePosition : 2
[7/30/2020 5:38:19 PM]         ExpectingInput   : True
[7/30/2020 5:38:19 PM]     ErrorRecord       : 
[7/30/2020 5:38:19 PM]         Exception             : 
[7/30/2020 5:38:19 PM]             Type    : System.Management.Automation.ParentContainsErrorRecordException
[7/30/2020 5:38:19 PM]             Message : Cannot bind argument to parameter 'InputObject' because it is null.
[7/30/2020 5:38:19 PM]             HResult : -2146233087
[7/30/2020 5:38:19 PM]         CategoryInfo          : InvalidData: (:) [Trace-PipelineObject], ParentContainsErrorRecordException
[7/30/2020 5:38:19 PM]         FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Functions.PowerShellWorker.Commands.TracePipelineObjectCommand
[7/30/2020 5:38:19 PM]         InvocationInfo        : 
[7/30/2020 5:38:19 PM]             MyCommand       : Trace-PipelineObject
[7/30/2020 5:38:19 PM]             HistoryId       : 1
[7/30/2020 5:38:19 PM]             CommandOrigin   : Internal
[7/30/2020 5:38:19 PM]         ScriptStackTrace      : at <ScriptBlock>, C:\Users\t-mipeng\Documents\azure-functions-powershell-worker\examples\durable\DurableApp\HumanInteractionOrchestrator\run.ps1: line 9
[7/30/2020 5:38:19 PM]     TargetSite        : 
[7/30/2020 5:38:19 PM]         Name          : BindValueFromPipeline
[7/30/2020 5:38:19 PM]         DeclaringType : System.Management.Automation.CmdletParameterBinderController, System.Management.Automation, Version=7.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
[7/30/2020 5:38:19 PM]         MemberType    : Method
[7/30/2020 5:38:19 PM]         Module        : System.Management.Automation.dll
[7/30/2020 5:38:19 PM]     StackTrace        : 
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindValueFromPipeline(PSObject inputToOperateOn, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingStateInParameterSet(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingState(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParametersPrivate(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParameters(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CommandProcessor.Read()
[7/30/2020 5:38:19 PM]     Source            : System.Management.Automation
[7/30/2020 5:38:19 PM]     HResult           : -2146233087
[7/30/2020 5:38:19 PM] CategoryInfo          : InvalidData: (:) [Trace-PipelineObject], ParameterBindingValidationException
[7/30/2020 5:38:19 PM] FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Azure.Functions.PowerShellWorker.Commands.TracePipelineObjectCommand
[7/30/2020 5:38:19 PM] InvocationInfo        :
[7/30/2020 5:38:19 PM]     MyCommand       : Trace-PipelineObject
[7/30/2020 5:38:19 PM]     HistoryId       : 1
[7/30/2020 5:38:19 PM]     CommandOrigin   : Internal
[7/30/2020 5:38:19 PM] ScriptStackTrace      : at <ScriptBlock>, C:\Users\t-mipeng\Documents\azure-functions-powershell-worker\examples\durable\DurableApp\HumanInteractionOrchestrator\run.ps1: line 9
[7/30/2020 5:38:19 PM]
[7/30/2020 5:38:19 PM]
Exception: Cannot bind argument to parameter 'InputObject' because it is null.
Stack:    at System.Management.Automation.CmdletParameterBinderController.BindValueFromPipeline(PSObject inputToOperateOn, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingStateInParameterSet(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindUnboundParametersForBindingState(PSObject inputToOperateOn, CurrentlyBinding currentlyBinding, UInt32 validParameterSets)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParametersPrivate(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CmdletParameterBinderController.BindPipelineParameters(PSObject inputToOperateOn)
[7/30/2020 5:38:19 PM]    at System.Management.Automation.CommandProcessor.Read().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions