Using methods with parameters from the User Code Library

Class library usage, coding and language questions.
shamann
Posts: 3
Joined: Wed Mar 20, 2019 3:12 pm

Using methods with parameters from the User Code Library

Post by shamann » Wed May 22, 2019 10:31 am

Hello,

I've been trying to add a method to my User Code Library. I could use it in a recording when it didn't have parameters, but when I added parameters, I could find the method anymore.

Like this. It doesn't appear in my UserCodeCollection anymore:

Code: Select all

 [UserCodeMethod]
 public void foo(RepoItemInfo inputtagInfo){  }
It does work when I remove the parameters though (which unfortunately doesn't meet my needs):

Code: Select all

 [UserCodeMethod]
 public void foo() {  }
Is there a possibility to achieve using that method without copying it to every Recording Module?

Thanks in advance,
Stephan

McTurtle
Posts: 255
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Using methods with parameters from the User Code Library

Post by McTurtle » Wed May 22, 2019 11:02 am

Hi shamann,

In order to use RepoItemInfo, you need to add the "using Ranorex.Core.Repository;" namespace to the User Code Collection.
UserCodeCollectio.png
UserCodeCollectio.png (2.17 KiB) Viewed 104 times
Have you done that?

Regards,
McTurtle

shamann
Posts: 3
Joined: Wed Mar 20, 2019 3:12 pm

Re: Using methods with parameters from the User Code Library

Post by shamann » Wed May 22, 2019 11:09 am

Hi McTurtle,

It worked. Thanks!