Today, Monday, I confirmed it was reproducible. Ranorex would get to the end of the test run and just pause indefinitiely. It wouldn't return control to Ranorex Studio, and sometimes I'd lose all control over my mouse. I was having to hit Alt+F4 to break the lock-up. Sometimes this would close Ranorex Studio after it asked if I wanted to end the debugger. Sometimes it'd attempt to close the AUT, and this would be enough to cause Ranorex to break the debug session and finish up, so I could review the report.
- Couldn't see what was wrong in the Ranorex report; it got to the end of the test case and stalled completely, until interrupted via Alt+F4.
- Narrowed it down to a particularly problematic test case.
- Recreated it as a new test case with just the core ingredients that reproduced the lock-up.
- Noticed that it only occured if I closed then restarted the AUT.
- Spent a while investigating Repository cache refreshes, but all seemed to be okay.
- Sometimes if I waited long enough I'd see a curious warning about a message box dialog.
- In console mode I could see that the logger was shutting down and then restarting with this curious warning.
- Eventually I started looking at some PopupWatcher-based code.
- And finally the penny dropped.
Seems like stopping and restarting the AUT without cleaning up the PopupWatcher thread was completely borking everything. As soon as I recoded this errant PopupWatcher-based code module to work the way I had expected it to, the problem immediately went away.
Took a while but got to the bottom of it in the end. I immediately reviewed all my other PopupWatcher-based experiments and deleted them from our Ranorex code-base so that they don't confuse the next person that falls into this little gotcha.