StopAllPopupWatchers does not remove the keys

Class library usage, coding and language questions.
loonquawl
Posts: 50
Joined: Wed Nov 22, 2017 10:08 am

StopAllPopupWatchers does not remove the keys

Post by loonquawl » Thu Feb 15, 2018 2:12 pm

Hi. twimc,

I ran into a problem using the Popup watchers. If i start one or more, then use StopAllPopupWatchers to kill them all, they are killed, but their keys remain in the watchers-class. Trying to reinstate that Popupwatcher later will result in an error, because the key is already in the dict.

The StopPopupWatcher has a line that does watchers.Remove(key);

but the StopAllPopupWatchers doesn't.

So i adapted the code to:

Code: Select all

                    foreach (var watcherpair in watchers)
			{
				var watcher = watcherpair.Value;
				string key = watcherpair.Key;
				watcher.Clear();
				watcher.Stop();
				Report.Info("Popup watcher " + key + " stopped.");
			}
			watchers.Clear();

McTurtle
Posts: 191
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: StopAllPopupWatchers does not remove the keys

Post by McTurtle » Mon Feb 19, 2018 3:30 pm

Hi loonquawl,

What you did sounds about right :)
Did it work or do you still need any help with this?

Regards,
McTurtle

loonquawl
Posts: 50
Joined: Wed Nov 22, 2017 10:08 am

Re: StopAllPopupWatchers does not remove the keys

Post by loonquawl » Tue Feb 20, 2018 1:06 pm

Thanks McTurtle, the current code works.

ahoisl
Certified Professional
Certified Professional
Posts: 125
Joined: Fri Sep 07, 2007 8:16 am

Re: StopAllPopupWatchers does not remove the keys

Post by ahoisl » Wed Feb 21, 2018 11:43 am

FYI, I opened an issue for this problem on the corresponding GitHub project:
https://github.com/ranorex/Packages/issues/22

Should be fixed soon :D

Regards,
Alex
Ranorex Team