WrapArgsForInvokeCall ?

Hi Jason,

i a little problem with this function.

I used SolidEdge 19 and i converted the code of the vb wizard in visual studio 2005

 

The problem in this function

 

addin.SetAddInInfo(Marshal.GetHINSTANCE(Me.GetType().Module).ToInt32(), EnvCatID, "SEAddin1", 1, 2, 1, 2, 2, commandNames, commandIDs)

 

is

 

Object reference not set to an instance of an object.

mscorlib

at System.RuntimeType.WrapArgsForInvokeCall(Object[] aArgs, Int32[] aWrapperTypes)

at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

at SolidEdgeFramework.AddIn.SetAddInInfo(Int32 InstanceHandle, String EnvironmentCatID, String CategoryName, Int32 IDColorBitmapMedium, Int32 IDColorBitmapLarge, Int32 IDMonochromeBitmapMedium, Int32 IDMonochromeBitmapLarge, Int32 NumberOfCommands, Array& CommandNames, Array& CommandIDs)

at SEAddin1.Addin.OnConnectToEnvironment(String EnvCatID, Object pEnvironmentDispatch, Boolean bFirstTime) in P:\etc\Parallaksis\Collaboration Desktop\.NET Framework 2.0\3.1\SRC\3rdTier\Bridges\SolidEdge\SEAddin1\Addin.vb:line 63

 

Why ?

 

tnx,

Vincenzo.

 

Posted by: Vincenzo Papa
Post date: 6/6/2007 9:36:21 PM

1 REPLY

RE: WrapArgsForInvokeCall ?

Hi Vincenzo,

 

this method only works using Reflection in .Net 2.0.

 

Try the following (this was written on the fly and I haven't tested it as I've only done it in C# before):

 

addIn.GetType().InvokeMember("SetAddInInfo", System.Reflection.BindingFlags.InvokeMethod, Nothing, addIn, New Object() {Marshal.GetHINSTANCE(Me.GetType().Module).ToInt32(), EnvCatID, "SEAddin1", 1, 2, 1, 2, 2, commandNames, commandIDs})

 

Hope this helps

Calum

 

Posted by: Calum McLellan
Post date: 6/6/2007 11:20:04 PM