32 or 64 bit version of product: 64
Operating system: Windows 10 Build 14393
32 or 64 bit OS: 64
Hi
Using the following simple code:
Code: Select all
param
(
[Alias('h')]
$help,
[Parameter(ParameterSetName = 'add')]
$add,
$remove
)
Write-Host "Hello World"
$ExitCode = 0
Error executing script.
Object reference not set to an instance of an object.
PoshExeHostCmdV3
at (Object )
at ..(String , String[] )
at ..(String[] )
Int32 (System.Object)
If you remove the parameter set information line and recompile, the error goes away.
The same error also occurs if you have "[CmdletBinding()]" set
This problem is causing an issue in a more complex script I have compiled, where command line arguments are being ignored.
The error only occurs in compiled code; scripts run normally.
Thanks
G