Recently I updated our 1-year old Mac Classic app to the Unified API, and since that time we've been getting occasional crashes like the following:
Message: AppKit Consistency error: you are calling a method that can only be invoked from the UI thread.
Source: Xamarin.Mac
at AppKit.NSApplication.EnsureUIThread () [0x0001f] in <379018de32e5466391eaea99f15edc7a>:0
at AppKit.NSWindow.get_WeakDelegate () [0x00001] in <379018de32e5466391eaea99f15edc7a>:0
at AppKit.NSWindow.get_Delegate () [0x00001] in <379018de32e5466391eaea99f15edc7a>:0
at AppKit.NSWindow.EnsureNSWindowDelegate () [0x00001] in <379018de32e5466391eaea99f15edc7a>:0
at AppKit.NSWindow.remove_WillClose (System.EventHandler value) [0x00001] in <379018de32e5466391eaea99f15edc7a>:0
at <appname>.View.Core.FSBaseListForm.Finalize () [0x00000] in <8817c6b956f7423c90ba1431191f9134>:0
These errors have only started appearing since the upgrade. The application involves, at a basic level, users updating parameters on open forms, and then calculations occurring in the 'background' (i.e. in response to the button click, but 'global' code) and then an always-open form that displays a report being updated.
As these errors didn't occur previously, I'm a bit curious as to what might have changed. I'm aware of the "NSApplication.CheckForIllegalCrossThreadCalls" setting, but also know it's not really a good idea to set it to 'true' and hope for the best; however, we haven't had any reports from any user previously about random crashes, nor have they shown up in testing in-house.
So ... any tips on how to narrow down the error or whether they can be ignored would be great, as right now I'm a bit stumped.