G
Guest
Attempting to pass a VBScript Array of Bytes to a C# Managed COM object has
resulted in some very undesirable and strange behavior. When definining a
method in my C# COM class as "void Write(byte[] bBytes)" or "void
Write(byte[] bBytes, int nLen)" or "int Write(byte[] bBytes, int
nLen)"VBScript returns a "Invalid procedure call or argument" exception.
However when I define the method as "int Write(byte[] bBytes)" it works just
fine. Unfortunately the method definition that works is not the one I need.
Regardless of whether one works or one doesn't work, they should all work.
Does anyone know why the CCW can't handle the method definition, and why it
is behaving in such a flakey manner?
Things I have tried to make it work:
- I have used the appropriate MarshalAs attribute in front of the byte[]
array.
- I have used the [ClassInterface(ClassInterfaceType.None)] attribute with
an explicit interface to make the tlbexp tool explicitly define the interface
methods.
resulted in some very undesirable and strange behavior. When definining a
method in my C# COM class as "void Write(byte[] bBytes)" or "void
Write(byte[] bBytes, int nLen)" or "int Write(byte[] bBytes, int
nLen)"VBScript returns a "Invalid procedure call or argument" exception.
However when I define the method as "int Write(byte[] bBytes)" it works just
fine. Unfortunately the method definition that works is not the one I need.
Regardless of whether one works or one doesn't work, they should all work.
Does anyone know why the CCW can't handle the method definition, and why it
is behaving in such a flakey manner?
Things I have tried to make it work:
- I have used the appropriate MarshalAs attribute in front of the byte[]
array.
- I have used the [ClassInterface(ClassInterfaceType.None)] attribute with
an explicit interface to make the tlbexp tool explicitly define the interface
methods.