I am getting fatal error in Application.GetForms()

Bug reports.
arishahsan
Posts: 26
Joined: Thu Jan 18, 2007 12:04 pm

I am getting fatal error in Application.GetForms()

Post by arishahsan » Mon Apr 16, 2007 5:54 am

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.

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Mon Apr 16, 2007 8:14 pm

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