Apologies for the clickbaity title; I couldn’t resist. I’ve found that I can reproducibly crash the NovaExtension service by:
- Creating an instance of a class conforming to the
Disposableinterface. - Registering the object with Nova in the constructor via
nova.subscriptions.add(this) - Unregistering the object from Nova in the
dispose()call, e.g.nova.subscriptions.delete(this) - Activating, then deactivating the extension (in ad hoc mode).
This results in the extension service crashing while reporting Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x60000228def0> was mutated while being enumerated.' (that thing about mutating a collection while enumerating is what sent me sleuthing in my disposal logic; full crash log can be sent on request).
Now, while I understand the underlying problem – mutating a collection while enumerating it is ill-advised; it is, however, also an easy error to make – and fully acknowledge my own ham-fistedness, I feel that in the specific case of Nova extension object disposal, some guards against that kind of error might be helpful. It may just be me, but I think the application’s whole extension runtime should not go down in flames when one extension does janky stuff.