Book a Demo

Author Topic: HELP! invalid parameter(s)  (Read 6111 times)

Stuart Trotter

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
HELP! invalid parameter(s)
« on: July 18, 2006, 07:12:26 am »
Hi,

I need some urgent help with a C# add-in which I am trying to write. I have been through the example add-ins on the web site and I have managed to get my add-in to install into EA without error. However when I try to execute a method in the add-in using the EXEC_ADD_IN macro from a code template, I get an invalid parameter(s) error which is driving me round the bend  >:(

code sample:

public object STGetClassAttributes(EA.Repository Repository)
{
 return "";
}

as you can see I've made the method as simple as possible just to try and get something to run. If anyone has any ideas (anything at all), I'd really appreciate it.

Thanks,
Stuart

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #1 on: July 18, 2006, 10:58:46 am »
Stuart,

What's giving you the error, EA or C#?

In the latter case would explicitly downcasting the return work? Something along these lines:

return (object) "";

Apart from that I don't know, but please post the solution when you find it. I've been putting off building an internal add-in with C# but am now about to start. I will likely run into the same issue.

David
No, you can't have it!

Stuart Trotter

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #2 on: July 18, 2006, 11:12:24 am »
Hi David,

The error is being raised by EA when I run the code gen, but I'll try your suggestion and let you know how it goes.

Thanks,
Stuart

Stuart Trotter

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #3 on: July 18, 2006, 11:31:52 am »
David,

'Fraid no joy, I get the same behaviour.

Cheers,
Stuart

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #4 on: July 18, 2006, 11:39:14 am »
I didn't think it would work if the error was from EA. We'll have to wait for the other members or Sparx to give us some hints.

Hang in there Stuart. Someone must have seen this before, and there are working add-ins out there.
No, you can't have it!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #5 on: July 18, 2006, 02:32:26 pm »
Just a thought...

What about declaring STGetObjectAttributes as type string instead of type object? Even though you are returning a string, it may be cast to an object before EA gets to it. That would seem to contradict the return type indicated in section 10.4.1.4.2.4 of the EA User Guide (as of build 792).
No, you can't have it!

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #6 on: July 18, 2006, 04:44:00 pm »
The method signature must include the repository object, and an array for any additional arguments.  Using the below example, convert the second parameter to string[], then use args[n] to access any additional parameters passed from the EXEC_ADD_IN call.

Code: [Select]
// sample EXEC_ADD_IN call
public object MyAddInFunction(EA.Repository repository, object argsObject)
{
string[] args = (string[])argsObject;
return "";
}

Hope this helps.

Stuart Trotter

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: HELP! invalid parameter(s)
« Reply #7 on: July 21, 2006, 07:58:15 am »
Hi,

Sorry I've taken so long to get back to you, I just wanted to say thanks a million, the argObjects worked like a charm!!!

Cheers,
Stuart