Time-out Exception calling Desktop.Instance.Windows()

Jun 2, 2008 at 2:27 PM
Hi, i'm calling Desktop.Instance.Windows() to retrieve the windows but all i get is this exception: "Core.UIItems.UIActionException: Window didn't respond, after waiting for 5000 ms"
Am i missing something? Tried it on two different machines. Does it have anything to do with the language of WinXP ?

Thanx! /POi
Coordinator
Jun 3, 2008 at 7:41 AM
Can you send me the stacktrace of the error.
Jun 3, 2008 at 8:29 AM
Edited Jun 3, 2008 at 12:40 PM
Here is the trace:

Window didn't respond, after waiting for 5000 ms

   vid Core.UIItems.WindowItems.Window.WaitWhileBusy() i d:\white-os\Core\UIItems\WindowItems\Window.cs:rad 175
   vid Core.UIItems.WindowItems.Window..ctor(AutomationElement automationElement, InitializeOption initializeOption, WindowSession windowSession) i d:\white-os\Core\UIItems\WindowItems\Window.cs:rad 47
   vid Core.UIItems.WindowItems.Win32Window..ctor(AutomationElement automationElement, WindowFactory windowFactory, InitializeOption option, WindowSession windowSession) i d:\white-os\Core\UIItems\WindowItems\Win32Window.cs:rad 16
   vid Core.Factory.ChildWindowFactory.Create(AutomationElement element, InitializeOption option, WindowSession windowSession) i d:\white-os\Core\Factory\ChildWindowFactory.cs:rad 36
   vid Core.Factory.WindowFactory.DesktopWindows() i d:\white-os\Core\Factory\WindowFactory.cs:rad 147
   vid Core.Desktop.Windows() i d:\white-os\Core\Desktop.cs:rad 58
  

It seems as if the command application works properly if started from cmd ... but NOT if started directly by double-clicking the .exe. ... then i get the time-out.
Coordinator
Jun 8, 2008 at 2:42 PM
Can please you find out and let me know what is the actual exception is before this.

Here is what you would need to do.
Go to this method:
WaitWhileBusy in window class. In the exception block, log the actual exception which is lost because of my stupid implementation.
In other words, change this line:
throw new UIActionException(string.Format("Window didn't respond" + Constants.BusyMessage));
to
throw new UIActionException(string.Format("Window didn't respond" + Constants.BusyMessage), e);

sorry for trouble.
Jun 9, 2008 at 10:26 AM
Well this is the exeption that gets thrown:

WindowPattern windowPattern = (WindowPattern) Pattern(WindowPattern.Pattern);
                if (!windowPattern.WaitForInputIdle(CoreAppXmlConfiguration.Instance.BusyTimeout))
                    throw new Exception("Timeout occured" + Constants.BusyMessage);

(When starting the command application via a shortcut or double-clicking it ... i get this behavior. But when i start from a command window it behaves accordingly.)

I wrote out witch window was bugging me so i added Console.WriteLine("Waiting for window with title: " + Title)  just before the WaitWhileBusy() in the constructor. And of course the WaitForInputIdle was waiting for the command window that pops up when clicking the shortcut.

I'll probably move the code to a regular winforms application later but it's a bit interesting why this does not happen when starting the application from cmd.
Coordinator
Jun 9, 2008 at 2:47 PM
Yes it is interesting, I would try to give it a shot.
Thanks for responding.
Coordinator
Jul 2, 2008 at 8:45 PM
I tried it but wasnt able to reproduce.