PropertyValue(“App.MacOSXAppName”) doesn't update (Ventura, Xojo 2019R1.1)

Using Xojo 2019r1.1, I have an IDE Script which builds a multi-project app. It uses SelectWindow() to switch IDE windows. To make sure the proper window is selected, it checks the value of PropertyValue(“App.MacOSXAppName”) - e.g.

SelectWindow(2) ' switch to the helper app window
If PropertyValue("App.MacOSXAppName") <> "MyHelperApp" then
   print "Error, wrong window selected?"
end if

This has worked fine for years, but suddenly (after upgrading from Monterey 12.6 to Ventura 13.1) it’s failing.

When it fails, I can see that the proper window has been selected in the IDE, but the value of PropertyValue(“App.MacOSXAppName”) is equal to the value for the window which is now in the background.

This feels like some sort of refresh/timing bug.

Anyone know of a way to work around this? Perhaps I could add a short delay to the IDE script?

I found a workaround - add a sleep() command in the shell after SelectWindow():

DoShellCommand("sleep 1") ' this prevents the next line from failing in Ventura
If PropertyValue("App.MacOSXAppName") <> "MyHelperApp" then