Page 1 of 1

Invoke Remotely Failure

Posted: Thu Apr 16, 2009 4:51 pm
by Captain Nemo
I have this simple code:

[STAThread]
public static int Main(string[] args)
{

PluginManager.Instance.LoadDefaultPlugins();

Ranorex.Core.Element el = "/form[@controlname='MainForm']/element[@controlname='ribbon']";
Ranorex.Control ctrl = new Control(el);
ctrl.Click();
string value = (string)ctrl.InvokeRemotely(getSynchronisedRibbonObject);

return 0;
}


static object getSynchronisedRibbonObject(System.Windows.Forms.Control control, object inputData)
{
return "Test";
}

What I get is:

Ranorex.ActionFailedException: Action 'invokeremotely' failed on element '{Unknown:ribbon}'. ---> System.InvalidOperationException: The control does no longer exist.
at Ranorex.Core.Element.InvokeAction
at Ranorex.Control.InvokeRemotely
at Ranorex.Control.InvokeRemotely

The control does indeed exist, as I click it before doing the invokeRemotely call. Can anyone see where I'm going wrong here?

Posted: Fri Apr 17, 2009 10:59 am
by Support Team
Are you starting your testing application from a network share or another location with limited security? The DLLs/EXEs that contain the delegates which should be called remotely need to reside in a location with full trust.

You can either copy your testing executable on a local drive or you can change the .NET security settings using the “Microsoft .NET Framework 2.0 Configuration” program in the found under “Administrative Tools” in your Windows Control Panel where you can edit the “Runtime Security Policy” for your user or machine. For an easy way to just give full trust to your network drive, see the following link how to do that:
http://www.sellsbrothers.com/news/showT ... Topic=1519

Regards,
Alex
Ranorex Support Team

Posted: Tue Apr 21, 2009 1:14 pm
by Captain Nemo
The problem was that I was running the testing app in a different directory to the application under test. After copying my dll's to that location and running from there, no problems at all.

Posted: Tue Apr 21, 2009 6:18 pm
by Support Team
Usually, that should not be needed, unless you did not install Ranorex on that computer and just copied all the Ranorex DLLs to the directory containing your testing app.

Regards,
Alex
Ranorex Support Team

Posted: Wed Apr 22, 2009 9:21 am
by Captain Nemo
Ranorex is installed and licensed properly on the machine, I've always had to use this approach when using InvokeRemotely.

Posted: Wed Apr 22, 2009 9:57 am
by Support Team
As Alex mentioned before it can be an security restriction issue (Network Drive etc). There can also be a problem when your referenced "Delegate DLL`s" are in your home folder (C:\Documents and Settings\User...)

Regards,
Christian
Ranorex

Posted: Wed Apr 22, 2009 10:02 am
by Captain Nemo
You've hit that one on the head, my test suite is located in a folder on my desktop.