T
Tom
I'm getting this error when I try to pass a structure to a dll.
An unhandled exception of type 'System.ArgumentException' occured in
Test1.exe
Additional Information: Type could not be marshaled because the length
of an embedded array instance does not match the declared length in the
layout
What does it mean?
Here's the structure:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
Public Structure udtINTER01
<VBFixedString(8), MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
Public action As Char()
<VBFixedString(7), MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)>
Public equip_key As Char()
<VBFixedString(256), MarshalAs(UnmanagedType.ByValArray,
SizeConst:=256)> Public message As Char()
<VBFixedString(512), MarshalAs(UnmanagedType.ByValArray,
SizeConst:=512)> Public filler As Char()
End Structure
I reviewed the length of each element of the structure at runtime and
they all match the lengths in the structure.
I don't want to use ByValTStr because of the trailing null it adds.
I've tried Byte() instead of Char(). No difference.
I've removed VBFixedString(). No difference.
What does it want??
Tom
An unhandled exception of type 'System.ArgumentException' occured in
Test1.exe
Additional Information: Type could not be marshaled because the length
of an embedded array instance does not match the declared length in the
layout
What does it mean?
Here's the structure:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
Public Structure udtINTER01
<VBFixedString(8), MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
Public action As Char()
<VBFixedString(7), MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)>
Public equip_key As Char()
<VBFixedString(256), MarshalAs(UnmanagedType.ByValArray,
SizeConst:=256)> Public message As Char()
<VBFixedString(512), MarshalAs(UnmanagedType.ByValArray,
SizeConst:=512)> Public filler As Char()
End Structure
I reviewed the length of each element of the structure at runtime and
they all match the lengths in the structure.
I don't want to use ByValTStr because of the trailing null it adds.
I've tried Byte() instead of Char(). No difference.
I've removed VBFixedString(). No difference.
What does it want??
Tom