InvokeRemotely & DevExpress Grid
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
InvokeRemotely & DevExpress Grid
Has anyone used InvokeRemotely to further interrogate a DevExpress xtraGrid?
I want to get the image in a cell in such a grid, but I can't get anything returned at the moment. It either returns null, or complains that the control is no longer in existance (when it is).
Any thoughts anyone?
Cheers
Chris
I want to get the image in a cell in such a grid, but I can't get anything returned at the moment. It either returns null, or complains that the control is no longer in existance (when it is).
Any thoughts anyone?
Cheers
Chris
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
Re: InvokeRemotely & DevExpress Grid
Sorry have not tried that one.
what are you trying to accomplish with the image? Do you just want to put that image in the log? If so, can you get the cell object then use the report.screenshot(cell_object) functionality within Ranorex to put the cell image in the log?
Sorry if that is not what you are looking for.
what are you trying to accomplish with the image? Do you just want to put that image in the log? If so, can you get the cell object then use the report.screenshot(cell_object) functionality within Ranorex to put the cell image in the log?
Sorry if that is not what you are looking for.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
I'm trying to get an image out of the cell then fuzzy compare that image against one from our resource file, to check it is the right one...
Or just the image index would do... but I can't seem to "InvokeRemotely" anything out of the grid, I just get errors.
Or just the image index would do... but I can't seem to "InvokeRemotely" anything out of the grid, I just get errors.
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
InvokeRemotely should work with DevExpress, several Ranorex customers (and our own samples) use this method with DevExpress controls.
Please, make sure that neither Ranorex nor your DevExpress assemblies are installed on a network drive or in an encrypted folder. Ranorex needs access to the DevExpress assemblies and if they are in such a location, Ranorex possibly can't load the assemblies.
Have you tried returning anything simple like a constant integer in your InvokeRemotelyDelegate method? That way you can check whether the InvokeRemotely works at all.
Regards,
Alex
Ranorex Support Team
Please, make sure that neither Ranorex nor your DevExpress assemblies are installed on a network drive or in an encrypted folder. Ranorex needs access to the DevExpress assemblies and if they are in such a location, Ranorex possibly can't load the assemblies.
Have you tried returning anything simple like a constant integer in your InvokeRemotelyDelegate method? That way you can check whether the InvokeRemotely works at all.
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
Can I confirm that I'm calling it correctly then... (this is using the devexpress xtragrid tutorials app on the "Custom Draw" page.)
When the test is run, the assertion fires because outputData1 is null. I'm sure I'm doing something stupid here, but I really can see what it is...
When the test is run, the assertion fires because outputData1 is null. I'm sure I'm doing something stupid here, but I really can see what it is...
Code: Select all
[Test]
public void GetValueFromGrid()
{
Control gridcontrol = "/form[@controlname='frmMain']/container[@controlname='pcMain']/container[@controlname='gcContainer']/container[@controlname='GridCustomDraw']/element[@controlname='gridControl1']";
SerializableGridData[] outputData1 = (SerializableGridData[])gridcontrol.InvokeRemotely(GetDataDelegate);
Assert.NotNull(outputData1);
}
[Serializable]
private class SerializableGridData
{
public string control;
}
private static object GetDataDelegate(System.Windows.Forms.Control control, object unused)
{
var remoteGrid = (DevExpress.XtraGrid.GridControl)control;
List<SerializableGridData> remoteOutputData = new List<SerializableGridData>();
SerializableGridData data = new SerializableGridData();
data.control = "some text";
remoteOutputData.Add(data);
return remoteOutputData.ToArray();
}
}
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
Your code looks OK to me, could you post the code for the GetDataDelegate method, too?
If null is returned, it could be that the return value of your method is either null or not serializable! You should try with a very simple delegate method like the one below:
Alex
Ranorex Support Team
If null is returned, it could be that the return value of your method is either null or not serializable! You should try with a very simple delegate method like the one below:
public object RemotelyInvokedDelegate(WinForms.Control control, object inputData) { return 12345; }Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
GetDataDelegate is already in that code, just scroll down a bit 
And I'm returning a string in the serializable object, so that should be fine.

And I'm returning a string in the serializable object, so that should be fine.
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
Ooops, sorry, my faultchrisgeorge wrote:GetDataDelegate is already in that code, just scroll down a bit

Please, try to return a simple constant value in the GetDataDelegate method (no array). If that works, try to make the SerializableGridData class public.
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
I tried this...
and it still triggers the NotNull assertion... It must be something to do with the control under test...
Code: Select all
[Test]
public void GetValueFromGrid()
{
Control gridcontrol = "/form[@controlname='frmMain']/container[@controlname='pcMain']/container[@controlname='gcContainer']/container[@controlname='GridCustomDraw']/element[@controlname='gridControl1']";
object outputData1 = gridcontrol.InvokeRemotely(GetDataDelegate);
Assert.NotNull(outputData1);
}
private static object GetDataDelegate(System.Windows.Forms.Control control, object unused)
{
return 12345;
}
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
It could be a security issue then, please refer to the following forum thread which discusses possible causes for that InvokeRemotely problem:
http://www.ranorex.com/forum/post2570.html#p2570
Regards,
Alex
Ranorex Support Team
http://www.ranorex.com/forum/post2570.html#p2570
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
Hmm... okay, I got it to work by copying the DevX grid tutorial app into by debug folder.
I then tried the same code against our devx grid in our plugin to SQL Server management studio, and it failed to work.
I tried copying our plugin dlls into the debug folder, and copying the compiled test dlls into our product folder. Both attempts failed.
I'm quickly running out of ideas!
I then tried the same code against our devx grid in our plugin to SQL Server management studio, and it failed to work.
I tried copying our plugin dlls into the debug folder, and copying the compiled test dlls into our product folder. Both attempts failed.
I'm quickly running out of ideas!

Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
Right, on further investigation it seems to not be confined to Devexpress controls.
In SQL Server management studio, on the "Object Explorer Details" page, there is an icon top left next to the name of the object. If I invoke remotely to that, it still returns null.
However, and this has been working for a while, I'm still able to invoke remotely onto the object explorer tree control to get tree item images back, and this works fine.
Code for the failing example:
(The moveTo is there to make sure the correct control is being found...)
In SQL Server management studio, on the "Object Explorer Details" page, there is an icon top left next to the name of the object. If I invoke remotely to that, it still returns null.
However, and this has been working for a while, I'm still able to invoke remotely onto the object explorer tree control to get tree item images back, and this works fine.
Code for the failing example:
Code: Select all
[Test]
public void GetValueFromPicture()
{
Control picturecontrol = @"/form[@title~'^Microsoft\ SQL\ Server\ Mana']/container[@caption='']/element/element[@class='DockingView' and @instance='1']/*/container[@caption='']/*/container[@controlname='rightPaneControl']/*/*/picture[@controlname='iconPlaceholder']";
object outputData1 = gridcontrol.InvokeRemotely(GetDataDelegate);
picturecontrol .MoveTo(new Point(10, 10));
Assert.NotNull(outputData1);
}
private static object GetDataDelegate(System.Windows.Forms.Control control, object unused)
{
return 12345;
}
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
That definitely looks like an assembly loading problem, it seems like Ranorex cannot find or is not allowed to load the assemblies containing the code for custom controls - that's why InvokeRemotely works on standard .NET Controls, but not on custom ones.
There are two reasons that come to my mind:
Regards,
Alex
Ranorex Support Team
There are two reasons that come to my mind:
- There's a bug in Ranorex 2.1.4 when using several AppDomains. If you use more than one AppDomain (e.g. NUnit can be configured to do that), custom Controls might not work, because the containing assemblies are not found.
- There's a security restriction that does not allow to load assemblies from anywhere except the current directory. This could be the case if you run Ranorex OR the automated application from a network share, from a compressed or encrypted directory, or sometimes even if you run it out of the "Documents and Settings" (WinXP)/"Users" (Vista) directory.
Regards,
Alex
Ranorex Support Team
-
- Posts: 49
- Joined: Thu Aug 20, 2009 11:28 am
Re: InvokeRemotely & DevExpress Grid
I've moving everything into the management studio directory and it still doesn't work, even with a simple picture control (which I believe is not custom).
All I actually want to do it get an image out of a devexpress grid cell...
All I actually want to do it get an image out of a devexpress grid cell...
Chris George
Test Engineer
Red Gate Software Ltd
Cambridge
Test Engineer
Red Gate Software Ltd
Cambridge
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: InvokeRemotely & DevExpress Grid
DevExpress is a custom control; custom control means every control not being one of the standard .NET controls that are delivered with the .NET framework. I.e. everything that is not in the System.Windows.Forms namespace.
What's about the other reason I mentioned, do you use NUnit or more AppDomains?
What's your operating system (WindowsXP, Vista)? Are you working on a 64 bit environment?
As a workaround you can get a screenshot of the cell by calling the Imaging.CaptureImage method passing the cell element.
Regards,
Alex
Ranorex Support Team
What's about the other reason I mentioned, do you use NUnit or more AppDomains?
What's your operating system (WindowsXP, Vista)? Are you working on a 64 bit environment?
As a workaround you can get a screenshot of the cell by calling the Imaging.CaptureImage method passing the cell element.
Regards,
Alex
Ranorex Support Team