G
Guest
I've got a doozie of a problem! I and others have been trying to figure this
out for too long and I've come to the conclusion that I should probably look
for some support..
Ok, I have a COM component written in C++ (I don't have the source just the
binary) and am referencing it from VB. I would say about 99% of the
functionality exposed by this COM component works fine from vb .net but I am
having a problem calling a method which has a parameter that is a struct
defined in the COM component. This struct has a member which is a struct
which contains an array of another struct. When I call the method I receive a
TypeLoadException with very little detail (thats about it) Here is the MSIL
for the structures.. The members who are causing the problems (i am about 99%
sure) are the members that end in "list"
'I have removed all of the members of the following struct who I feel are
defined correctly (i removed about 19 members of this struct). This is done
for the sake of simplicity
..class public sequential ansi sealed beforefieldinit tcsGroupAttributes_t
extends [mscorlib]System.ValueType
{
..pack 4
..size 0
..field public valuetype Nokia.TCSapi.tcsSubscriberAddress_t groupAddress
..field public valuetype Nokia.TCSapi.tcsOrgBlockAttributes2List_t
entryRightsList //THIS GUYS THE PROBLEM! 99% SURE!
} // end of class tcsGroupAttributes_t
' Here is the definition of tcsOrgBlockAttributes2List
..class public sequential ansi sealed beforefieldinit
tcsOrgBlockAttributes2List_t
extends [mscorlib]System.ValueType
{
..pack 2
..size 0
..field public unsigned int16 length
..field public marshal( fixed array [75]) valuetype
Nokia.TCSapi.tcsOrgBlockAttributes2_t[] orgBlockAttributes2List
} // end of class tcsOrgBlockAttributes2List_t
'Here is the definition of tcsOrgBlockAttributes2_t
..class public sequential ansi sealed beforefieldinit tcsOrgBlockAttributes2_t
extends [mscorlib]System.ValueType
{
..pack 2
..size 0
..field public marshal( fixed array [6]) unsigned int16[] orgBlockId
..field public marshal( fixed array [32]) unsigned int8[] orgBlockMnemonic
} // end of class tcsOrgBlockAttributes2_t
Ok, Here is the signature of the method that I am calling
(tcsGroupAttributesMask structure is straightforward and similiar objects
work in other calls so this structure is not the problem. Its the
tcsGroupAttributes)
..method public hidebysig newslot abstract virtual
instance int32 Create([in] valuetype Nokia.TCSapi.tcsGroupAttributes_t&
groupAttributes,
[in] valuetype Nokia.TCSapi.tcsGroupAttributesMask_t& groupAttributesMask,
[in] int16 cookie) runtime managed internalcall
{
}
This is an incredibley difficult problem and much respect to anyone that can
help or solve this. I have googled the ** out of this and have read nearly
every resource out there discussing COM interop. I have tried editing the
disassembled il and setting the member valuetypes to IntPtrs but then I get a
MissingFieldException.. Appreciate any help in advance!
Aaron
out for too long and I've come to the conclusion that I should probably look
for some support..
Ok, I have a COM component written in C++ (I don't have the source just the
binary) and am referencing it from VB. I would say about 99% of the
functionality exposed by this COM component works fine from vb .net but I am
having a problem calling a method which has a parameter that is a struct
defined in the COM component. This struct has a member which is a struct
which contains an array of another struct. When I call the method I receive a
TypeLoadException with very little detail (thats about it) Here is the MSIL
for the structures.. The members who are causing the problems (i am about 99%
sure) are the members that end in "list"
'I have removed all of the members of the following struct who I feel are
defined correctly (i removed about 19 members of this struct). This is done
for the sake of simplicity
..class public sequential ansi sealed beforefieldinit tcsGroupAttributes_t
extends [mscorlib]System.ValueType
{
..pack 4
..size 0
..field public valuetype Nokia.TCSapi.tcsSubscriberAddress_t groupAddress
..field public valuetype Nokia.TCSapi.tcsOrgBlockAttributes2List_t
entryRightsList //THIS GUYS THE PROBLEM! 99% SURE!
} // end of class tcsGroupAttributes_t
' Here is the definition of tcsOrgBlockAttributes2List
..class public sequential ansi sealed beforefieldinit
tcsOrgBlockAttributes2List_t
extends [mscorlib]System.ValueType
{
..pack 2
..size 0
..field public unsigned int16 length
..field public marshal( fixed array [75]) valuetype
Nokia.TCSapi.tcsOrgBlockAttributes2_t[] orgBlockAttributes2List
} // end of class tcsOrgBlockAttributes2List_t
'Here is the definition of tcsOrgBlockAttributes2_t
..class public sequential ansi sealed beforefieldinit tcsOrgBlockAttributes2_t
extends [mscorlib]System.ValueType
{
..pack 2
..size 0
..field public marshal( fixed array [6]) unsigned int16[] orgBlockId
..field public marshal( fixed array [32]) unsigned int8[] orgBlockMnemonic
} // end of class tcsOrgBlockAttributes2_t
Ok, Here is the signature of the method that I am calling
(tcsGroupAttributesMask structure is straightforward and similiar objects
work in other calls so this structure is not the problem. Its the
tcsGroupAttributes)
..method public hidebysig newslot abstract virtual
instance int32 Create([in] valuetype Nokia.TCSapi.tcsGroupAttributes_t&
groupAttributes,
[in] valuetype Nokia.TCSapi.tcsGroupAttributesMask_t& groupAttributesMask,
[in] int16 cookie) runtime managed internalcall
{
}
This is an incredibley difficult problem and much respect to anyone that can
help or solve this. I have googled the ** out of this and have read nearly
every resource out there discussing COM interop. I have tried editing the
disassembled il and setting the member valuetypes to IntPtrs but then I get a
MissingFieldException.. Appreciate any help in advance!
Aaron