Book a Demo

Author Topic: EXEC_ADD_IN with C#: Invalid Parameter(s)  (Read 4598 times)

DanG83616

  • EA User
  • **
  • Posts: 180
  • Karma: +0/-0
    • View Profile
EXEC_ADD_IN with C#: Invalid Parameter(s)
« on: May 08, 2013, 08:47:32 am »
I've created a C# add-in and am trying to call it via EXEC_ADD_IN() from a model transformation template. The add-in shows up in the Extensions context menu and I can hit the break-point on the EA_GetMenuItems(). When I initiate the transform I get an Invalid Parameter(s) message before I hit the breakpoint for the function I'm calling.

The documentation says this:
"Any function that is to be called by the EXEC_ADD_IN macro must have two parameters: an EA.Repository object, and a Variant array that contains any additional parameters from the EXEC_ADD_IN call. Return type should be Variant."

For C#, I guess that would be:
Code: [Select]
public object FindGUID(EA.Repository Repository, object[] type);I also tried replacing "EA.Repository" with "object".

The template line is this:
Code: [Select]
 $result = %EXEC_ADD_IN("Pegasus", "FindGUID", "String passed from template")%
Can anyone see my mistake?

Thanks,
Dan
« Last Edit: May 08, 2013, 08:48:02 am by dgeorge83616 »

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: EXEC_ADD_IN with C#: Invalid Parameter(s)
« Reply #1 on: May 08, 2013, 05:08:11 pm »
Hi Dan
I have declared my C# method as
Code: [Select]
public object FindGUID(EA.Repository Repository, object args)
{
     string[] arguments = (string[])args;
}

arguments[0] will equal "String passed from template"

Hope this helps

Graham
Using V12

DanG83616

  • EA User
  • **
  • Posts: 180
  • Karma: +0/-0
    • View Profile
Re: EXEC_ADD_IN with C#: Invalid Parameter(s)
« Reply #2 on: May 09, 2013, 04:17:23 am »
Hi Graham,
that was the trick.  :)

Thanks,
Dan