NSUIActivityDocumentMonitor throws a strange exception

This class is throwing an NSInternalInconsistencyException immediately after my app delegate gets an ApplicationWillResignActive message as shown below. This happens only on 15.2.

In the Event processing run loop in my NSApplication subclass, I added a couple of lines to monitor the value of "mainWindow" as defined in NSApplication. It contains a valid window pointer until after the ApplicationWillResignActive message. FYI I do not appear to ever get a ApplicationDidResignActive call.

My questions:

  1. What is NSUIActivityDocumentMonitor and what exactly does it do? I can find no documentation on it at all. Should I assume it is created by NSDocument? Can or should I prevent its creation?

  2. The error text implies that my NSApplication subclass is not sending out a notification when its "mainWindow" property changes (in my case it appears to get changed to nil as a result of resigning the active state). That has never been an issue before now.

  3. This does not occur on ANY other prior macOS releases including 15.1. How can I prevent this error that is being thrown by a previously unknown class? Are there new recommended actions I should take when I get the ApplicationWillResignActive call? Wouldn't NSApplication/NSObject handle the KVO compliance issue (notify observers of a change to "mainWindow")?

  4. FYI, this only happens when I have an opened document window (either new or opened from the desktop).

  5. If I ignore the error in my run loop, the app continues normally in the background and can be brought back to be the front app no problem.

I'm at my wits end trying to get rid of this (properly instead of ignoring the error) and could use some guidance. This is a mature app in use by many clients. Objective C.

NSUIActivityDocumentMonitor throws a strange exception
 
 
Q