-1

I've tested this on Win XP and Windows Server 2008 R2 in Powershell 2.0:

$a = 1,2,3,4 # a simple [object[]] but any other Type is good

if I do:

$a.addres()

the return error is (correctly):

Method invocation failed because [System.Object[]] doesn't contain a method named 'addres'.

But if I do:

$a.address()

the error is:

Cannot find an overload for "Address" and the argument count: "0".

But doing:

$a.address(2)

close powershell console with an 'Problem Event Name: APPCRASH'

starting from that [system.array] has not a method called address how powershell try to call an existing method?

CB.
  • 58,865
  • 9
  • 159
  • 159
  • 1
    Interesting. On V3 I get this error `PS> $a.address(2) Exception calling "Address" with "1" argument(s): "Operation could destabilize the runtime."` – Keith Hill Apr 06 '12 at 15:19

2 Answers2

3

[System.Array] has .Get, .Set and .Address methods that are available via the .Net runtime but are not normally used in Powershell code. Have a look at this StackOverflow article:

Community
  • 1
  • 1
Darin Strait
  • 306
  • 2
  • 6
1

I submitted this as a bug a while back. They fixed it in V3 with the exception message Keith posted ( could destabilize the runtime )

https://connect.microsoft.com/PowerShell/feedback/details/561865/powershell-crashes-when-calling-address-method-on-object-array

Andy Arismendi
  • 50,577
  • 16
  • 107
  • 124