The apartment state of the current thread : Bug Reports

The apartment state of the current thread

Bug reports and feature requests.

The apartment state of the current thread

Postby omayer » Fri Dec 23, 2011 5:57 am

Why I am getting this warning - code module, 3.2 - The apartment state of the current thread is not set to STA. Please make sure that all threads accessing Ranorex methods have their apartment state set to STA.
warn.jpg
warn.jpg (29.16 KiB) Viewed 148 times
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: The apartment state of the current thread

Postby omayer » Fri Dec 23, 2011 6:02 am

ok, if i commented out this code then no warning -

/*****Check for any popup, click OK and terminate the test*********/
// Thread dialogWatchers = new Thread(rmaxValidation.WindowsPopUp);
// dialogWatchers.IsBackground = true;
// dialogWatchers.Start();

not sure why getting the warning
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: The apartment state of the current thread

Postby omayer » Fri Dec 23, 2011 6:05 am

ok problem solved.. i have to run one testcase then dialogwatcher that stopped the warning, wonder why is that warning
Tipu
omayer
 
Posts: 240
Joined: Thu Oct 28, 2010 7:14 pm

Re: The apartment state of the current thread

Postby Support Team » Fri Dec 23, 2011 11:07 am

You have to set the apartment state for every new thread to STA, otherwise identification capabilities of Ranorex may be limited:
Thread dialogWatchers = new Thread(rmaxValidation.WindowsPopUp);
dialogWatchers.IsBackground = true;
dialogWatcher.SetApartmentState(ApartmentState.STA);
dialogWatchers.Start();

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


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron