Unable to cast object of type 'System.Byte[*]' to type 'System.Byte[]

  • Thread starter Thread starter miller.brettm
  • Start date Start date
M

miller.brettm

Hi,

I'm working with an ActiveX serial component that fires an event when
data is received. I need to continue to use this component because it
contains the ability to do Xmodem1k an d XmodemCRC comms

The RX even fires and passes an Object (Type: Object) parameter. When
looking @ the Locals window it shows the Type as: Object { byte[] }

<Code>
Byte[] b = (Byte[])e.Data; //(Type Object)
</Code>

System.InvalidCastException: Unable to cast object of type
'System.Byte[*]' to type 'System.Byte[]

I've never seen a System.Byte[*] with an Asterrix before... Google
returns nothing....

Thanks for any help!
Bm
 
Hi,

I'm working with an ActiveX serial component that fires an event when
data is received. I need to continue to use this component because it
contains the ability to do Xmodem1k an d XmodemCRC comms

The RX even fires and passes an Object (Type: Object) parameter. When
looking @ the Locals window it shows the Type as: Object { byte[] }

<Code>
Byte[] b = (Byte[])e.Data; //(Type Object)
</Code>

System.InvalidCastException: Unable to cast object of type
'System.Byte[*]' to type 'System.Byte[]

I've never seen a System.Byte[*] with an Asterrix before... Google
returns nothing....

Thanks for any help!

I'd suggest casting to System.Array (or just using the watch window) and
checking the rank, maybe it's not rank 1.
 
Back
Top