Oops. Sorry Chris. What an embarrassing fail on my part. It is an infinite loop.
Your code is working fine.
I figured out what I am doing wrong. I am using:
Thread.AcquireLock('main')
and
Thread.ReleaseLock('main')
inside
ValidatePrefs()
I did this to prevent MainMenu() (which also uses this thread control) from running when the Prefs were being validated (and possibly changed). This was to try to prevent a race issue when referencing those values in MainMenu().
However, the Prefs update inside ValidatePrefs() also makes a postback to PMS and invokes ValidatePrefs() again. Which is blocked by the first call, because it has not finished yet.
It appears that PMS cannot complete the response to the first call while the second call is being blocked.
I verified this in your code.
Add these two threading lines to your code (the first at the beginning and the second at the end, of course) and you will see my problem.
The try block allows the failure to occur gracefully and the process completes as expected. This is not acceptable.
This brings up a concern about updating Prefs inside of ValidatePrefs() due to the callback issue. If several Prefs are updated sequentially (not all in one call) during the first pass, this could get ugly.
I will be changing my code to avoid this altogether. I already use a duplicate set for the Prefs to maintain the last set values to detect changes (which I need to know in my case). Therefore, I should NEVER use the Prefs, only their "last" values. That will be clean and I won't need the thread control at all; I'll let MainMenu control the updates.
I also realized that my thread control effort is not effective, as the changes to the Prefs occur before it enters ValidatePrefs().
I am not consistently thinking of this channel as a website, and not an application. Big difference there.
Thanks for the help!