Ranorex.CommandFailedException / SerializationException : Automation API - Page 2

Ranorex.CommandFailedException / SerializationException

Class library usage, coding and language questions.

Re: Ranorex.CommandFailedException / SerializationException

Postby jabelshauser » Thu Jun 25, 2009 4:56 pm

i have tried the version:

- ResetRanorexCore: after doing that, a FindForm-Command thows null-reference-exception. Are there constraints ?

- the Parent-Problem still occurs (also rarely)

what can i do else as workaround ?

regards jörg
jabelshauser
 
Posts: 38
Joined: Thu Aug 23, 2007 1:00 pm

Re: Ranorex.CommandFailedException / SerializationException

Postby Support Team » Thu Jun 25, 2009 11:34 pm

Some additional thoughts:

1.
Please check the ApartmentState of the NUnit thread, it must be STA (Single Threaded Apartement). Usually, NUnit runs the testing thread with an MTA apartment state while Ranorex assumes STA (and requires STA).

An instruction on how to do that can be found here:
http://www.hedgate.net/articles/2007/01 ... unit-test/
The first option is to place a config file in the same directory as you NUnit test library DLL. The second option is to create a new thread with STA in every test method calling Ranorex.

2.
Is it possible to run the most important part of the test without NUnit (from the command line).
I would like to check whether the problem exists only within NUnit or not.

Jenö
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Ranorex.CommandFailedException / SerializationException

Postby Skarlso » Mon Jun 29, 2009 10:55 am

Hello!

I have a solution for you...

I too have faced this problem when using nunit and DLL for execution and not EXE.

RanorexSpy is somehow locked up by nunit and that causes all your trouble.

The solution is more of a workaround then really a solution but at least it works.

One: Create Application Domains and put RAnorex into it.
Second this is more simple:

Create a plus Console Application that has the sole purpuse of executing a function that starts your respective test. And that Console Application will be started from your initial test.

So if you have a test like Calculator do the following.

Test: Press + Button.
[Test]
public void runTest( string someparameter)
{
Something.runTest( "PressPlusButton" );
}

This test is called by your Console Application which calls the respective test.
This way the Console Application will be between nunit and the Test. And after the test finishes it is no longer a problem because the EXE garbage collects the RanorexSpy properly. This way your long term test runs weill me no problem anymore.

Please ask away is something is unclear.
Gergely.
Skarlso
 
Posts: 27
Joined: Thu Aug 07, 2008 10:11 am

Re: Ranorex.CommandFailedException / SerializationException

Postby jabelshauser » Tue Jun 30, 2009 10:53 am

Hello Skarlso

Thank you for your help, but the behaviour occurs also in an easy main-application (STAThread) without NUnit, so the proposed solutions shouldn't be successful.

best regards Jörg
jabelshauser
 
Posts: 38
Joined: Thu Aug 23, 2007 1:00 pm

Re: Ranorex.CommandFailedException / SerializationException

Postby Skarlso » Tue Jun 30, 2009 3:20 pm

Did you try it out? :)

It happened to me too. This helped. If it does not help you, you can still revert. :)

It isn't a hard work takes thirty minutes tops.

Np, hope it helps anyways.
Gergely.
Skarlso
 
Posts: 27
Joined: Thu Aug 07, 2008 10:11 am

Previous

Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests