Exception when hiding the ProgressForm

Bug reports.
User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Exception when hiding the ProgressForm

Post by Ciege » Fri Jun 17, 2011 5:33 pm

I am using the ProgressForm to display updates to the user during a long process...

Code: Select all

Ranorex.Core.Reporting.TestReport.Setup(ReportLevel.None, "tempTestReport.rxlog", false);
Ranorex.Core.Reporting.TestReport.EnableTracingScreenshots = false;
Ranorex.Core.Reporting.TestReport.ReportWriteInterval = 0;
Ranorex.Controls.ProgressForm.Show();


At the end of the process I am hiding the ProgressForm but getting an exception.

Code: Select all

Ranorex.Controls.ProgressForm.Hide();
Exception:

Code: Select all

Fatal error: System.InvalidOperationException: Cross-thread operation not valid: Control 'ProgressForm' accessed from a thread other than the thread it was created on.
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Hide()
at Ranorex.Controls.ProgressForm.Hide()
at CBS_Import_Test.Program.VerifyTags(Form HDClientForm, String[] Tags) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\CBS Import Test\CBS Import Test\Program.cs:line 1127
at CBS_Import_Test.Program.CBSImportTest(String strDateTimeStamp, String strDateTimeStampClean) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\CBS Import Test\CBS Import Test\Program.cs:line 302
at CBS_Import_Test.Program.Main(String[] args) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\CBS Import Test\CBS Import Test\Program.cs:line 101
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...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Exception when hiding the ProgressForm

Post by Support Team » Mon Jun 20, 2011 12:00 pm

Hi Ciege,

Thank you for posting us this bug, currently as workaround you can the solution suggested by sdaly
http://www.ranorex.com/forum/can-i-cont ... t2318.html

With Ranorex 3.0.3 we will handle this in our code and you should remove the currently workaround.

Regards,
Peter
Ranorex Team
.
Image

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Exception when hiding the ProgressForm

Post by Ciege » Mon Jun 20, 2011 3:58 pm

Yup, I put in the crossthreadcheck = false and the issue is worked around successfully.
Thanks...
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...