Hi there, this is a bit of a beefy problem that i've been having with some code with several tendrils which will need to be loped off.

I am in the process of upgrading a software development kit from vb6 to vb.net. When i run the program i get an executionengineexception when i call the function gen2multitagidentify.

I initialize the structure array IDNUM which is one of the arguments of the function. This is on the advice of the upgrade engine.

Code:
 Dim IDNUM(100) As TagIds
        Dim i As Integer
        For i = 0 To 100
            IDNUM(i).Initialize()
        Next
        Dim FFZ As Short
        Dim CountID As Integer
        Try
            FFZ = Gen2MultiTagIdentify(hCom, CountID, IDNUM(0), 255)

As you can see it takes an array of structures which is where i think the problem could be. Here is my structure declaration with the appropriate marshalling attributes.

Code:
 <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
    Public Structure TagIds
        Dim TagType As Byte
        Dim AntNum As Byte
        <VBFixedArray(11)> Dim Ids() As Byte

        Public Sub Initialize()
            ReDim Ids(11)
        End Sub
    End Structure
The gen2multitagidentify function is defined in a .dll file here with a marshalling attribute supplied for the structure:

Code:
     Public Declare Function Gen2MultiTagIdentify Lib "\\SBS-CRM\Company\Project\RFID\visual_studio\DEMO VB Source\Mr915ApiV10.dll" (ByVal hCom As Integer, ByRef Count As Integer, <MarshalAs(UnmanagedType.Struct)> ByRef Value As TagIds, ByVal NetAddr As Byte) As Short
Can anyone see where i've gone wrong? The execution engine exception as listed in the msdn glossary provides an incredibly vague and unhelpful description of its causes. I've been working on this problem for 3 days now with no luck. Any help would be much appreicated.