macOS Ventura crash
Steps to Reproduce
I have received this crash report from AppCenter. It only happens for users on macOS 13.0 Ventura. It could be a macOS Ventura bug, but it feels like that some changes in this OS activate racing condition in Xamarin (this bug usually happens after hours of use of the app) and that it is a Xamarin bug. Technically it could be also app bug, but I think that the log would be different then and would point to at least some method in the app and I don't see how some sort of object disposal could directly call some list operation in the app.
Expected Behavior
No Crash
Actual Behavior
This is the crash log:
List`1+Enumerator[T].MoveNextRare ()
SIGTRAP: Collection was modified; enumeration operation may not execute.
List`1+Enumerator[T].MoveNextRare ()
List`1+Enumerator[T].MoveNext ()
NSObject+NSObject_Disposer.Drain (Foundation.NSObject ctx)
(wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
NSApplication.Main (System.String[] args)
MainClass.Main (System.String[] args)
Environment
Version information
Build Logs
Example Project (If Possible)
Thanks for the report.
Obviously that report doesn't have a huge amount of information, and the lines of code in question are rather slim:
https://github.com/xamarin/xamarin-macios/blob/main/src/Foundation/NSObject2.cs#L1016-L1017
I hope once we get our CI bots testing Ventura we'll start seeing it, or Apple fixes whatever change trigger this.
Thanks for the report.
Obviously that report doesn't have a huge amount of information, and the lines of code in question are rather slim:
https://github.com/xamarin/xamarin-macios/blob/main/src/Foundation/NSObject2.cs#L1016-L1017
I hope once we get our CI bots testing Ventura we'll start seeing it, or Apple fixes whatever change trigger this.
I am not familiar with the rest of the code, but those two lines seem to be quite open in generating that crash that is reported - I don't see anything that would block something from changing the list while it is enumerated there. If there is such a possibility to change that list (which as said depends on the rest of the code that I am not familiar with) and there is no blocking mechanism it is something that certainly needs to be done...
The code in question uses a "hot" list and a lock to swap the "active" list before enumerating over the old list for draining.
While it is possible it has a bug, so far we haven't hit this crash ever, on every other OS, so I'm suspecting Ventura broke some invariant.
I haven’t seen any report in a while, so it was likely Apple’s bug that was fixed.