Forum Discussion

soda's avatar
soda
Contributor
12 years ago

A recursive call to the "OnUnexpectedWindow" event handler has been detected

The dialog stating: A recursive call to the "OnUnepectedWindow" event handler has been detected.  If your code does not exit from the recursion properly,  a stack overflow error will occur and TestComplete.....  Do you want to continue the script execution.



Has anyone seen this warning?  Is there a way to avoid it?  Any thoughts on what is causing it?  It appeared after upgrading from TC8 to TC9.



Thanks

4 Replies

  • How this issue was resolved. We are also facing the similar issue on TC 10.6.

    • tonydugay's avatar
      tonydugay
      Contributor

      If you look at your TestComplete log, do you see any pictures of an unexpected window being closed/cleared?

       

      If so, maybe you can avoid the unexpected window appearing and the issue will be resolved?

  • Was this issue ever resolved?  I just ran into this for the first time.  I added an event but all it does is send a picture to the log.  Is it because I have options checked in the project options as well to close window on unexpected window?  Does anyone know if I have to uncheck those and close the window myself if I use a script event?  Thanks.

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Basically, the way this works is that the options in Project.Properties for UnexpectedWindow are executed first in order and then, if they fail, it goes to the event handler. So, if you want ONLY your event handler to happen, uncheck all those options.

       

      As for the original problem of "recursive call", basically what is happening there is that, within the OnUnexpectedWindow event handler, they are running code that is, again, triggering the Unexpected Window event which throws you into a loop.  It's the same thing, basically, as calling "Log.Error" within the "OnLogError" event handler.