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

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
 
B

Ben Voigt [C++ MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top