Page 2 of 2

Re: Ranorex.CommandFailedException / SerializationException

Posted: Thu Jun 25, 2009 3:56 pm
by jabelshauser
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

Re: Ranorex.CommandFailedException / SerializationException

Posted: Thu Jun 25, 2009 10:34 pm
by Support Team
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

Re: Ranorex.CommandFailedException / SerializationException

Posted: Mon Jun 29, 2009 9:55 am
by Skarlso
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.

Re: Ranorex.CommandFailedException / SerializationException

Posted: Tue Jun 30, 2009 9:53 am
by jabelshauser
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

Re: Ranorex.CommandFailedException / SerializationException

Posted: Tue Jun 30, 2009 2:20 pm
by Skarlso
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.