Page 1 of 1

I am getting fatal error in Application.GetForms()

Posted: Mon Apr 16, 2007 5:54 am
by arishahsan
Following is the code which gives error.

Application.GetForms();
foreach (Form TempForms in Application.Forms)
{
Form TempForm = Application.FindFormTitle(TempForms.Text);
Trace.Assert(TempForm != null);
//Error arises in the following line
if (TempForm.Element.Class == WindowsForms10.Window.8.app.0.33c0d9d)
{
//Some Statements
}

Error message is:

Fatal ExecutionEngine Error was executed
The runtime has encountered a fatal error. The address of the error was at 0x79e8a634, on thread 0x3fc. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Posted: Mon Apr 16, 2007 8:14 pm
by webops
Hi,

I can't reproduce the bug you described. Please try the following examples.

You can read all forms by classname as below:

Code: Select all

Application.GetForms();
foreach (Form TempForm in Application.Forms)
{
    if (TempForm.Element.Class == "WindowsForms10.Window.8.app.0.378734a")
    {
        Console.WriteLine("form found: " + TempForm.Text);
    }
}
If you want to find the first form by it's classname use the FindFormClassName() method:

Code: Select all

Form TempForm = Application.FindFormClassName("WindowsForms10.Window.8.app.0.378734a");
if (TempForm != null)
{
    Console.WriteLine("form found: " + TempForm.Text);
}
Gabor
Ranorex Team