Is EndException a problem?

I have created a geometrical calculation software using 2018.2. The calculations are rather complex and time consuming and makes heavy use of Threads and in-memory databases.

I develop on Mac and creating both Mac and PC versions. Using remote debugger to Parallels Windows 10 for testing on Windows.
My problem is now that when running on Windows using Remote Debugger 2.3 the IDE always breaks into EndException when I quit the application. This does not happen on Mac. The compiled application on Windows “sometimes” (like 1 of 10) times doesn’t quit successfully and instead showing “Application not responding”. No problems ever on Mac. This leads me to thing there is some underlaying problem affecting Windows.
At application close, I remove all Handlers for web-sockets, do Xojo.Core.Timer.CancelCall for all CallLater (that are all referenced using WeakAddressOf) and stop all running Threads.

Is the remote debugger telling me the truth that there is some problems?

If you get different results then you usually have a race condition. On the Mac I ignore EndExceptions.

Have you done the usual logging to see if you get different paths in the code when the app doesn’t quit?

I’ve seen this problem in past, on Windows, like you say. For some reason this disappeared without letting me to know the exact reason.

My guess is this is Threads related, due they perform differently on Windows and Mac. Try to observe the thread state when quitting, perhaps some resets on threads can solve the problem.

Additionally, from my experience, this might be a remote debug problem. Try to see if this also happens in built applications.

If you really can’t solve, as last resort you can try…catch the exception and ignore it.

Oldie but goodie that got the Windows app to behave (after about 100 launches, still no crash)
(insert drum-roll)


I put that in the app’s CancelClose.

(sarcasm) Please excuse me while I go grab a flame-proof vest while people prepare for the usual s**t-storm every time DoEvents() is mentioned

I would bet some of the threads don’t stop immediately, which crashes if the app is closed right away. Then you could use a timer to monitor the run state of the threads, and actually quit only when all threads are really gone.

They sure are. I see that the calculations on Windows “stutter” when running (possibly due to Parallels?) but running smooth on Mac. I run the same equations over and over and on Mac, they complete in the same time without any noticable difference. On Windows they do not, some calculations takes longer and some shorter.

In mye experience, this is not Parallels. Xojo + Windows instead

A thread is self-referencing, so maybe it really tends to stay alive a bit longer than it should when the app quits under Windows? Are there any timers or xojo.core.timer.calllaters that you use to update your GUI? If so, checking for existence of the window could help avoid the crash instead of doevents (which in this case should be safe IMHO – you are in app.quit and not responding to user events anymore).