Nimble crashes out when accessing Core Data properties in notifications fired off the main thread
- [x] I have read CONTRIBUTING and have done my best to follow them.
What did you do?
Used toEventuallyNot(postNotifications(..)) wrapping a Core Data operation that occurs on a background context.
What did you expect to happen?
The check to pass.
What actually happened instead?
The test crashed. It appears to be because NotificationCollector is collecting up the notifications, whatever thread they were thrown on, and then accessing them from the main thread.
Environment
List the software versions you're using:
- Quick: 4.0.0
- Nimble: 9.2.1
- Xcode Version: 13.2.1 and 13.3
- Swift Version: Xcode Default
Please also mention which package manager you used and its version. Delete the other package managers in this list:
- Carthage: 0.38.0 (Use
carthage versionin Terminal)
Project that demonstrates the issue
I would like to do this but I did a PR first so I'm going to just go that way first.
Have to admit, since posting this I remembered that the reason we were getting a crash 💥 was because we were passing the following argument:
-com.apple.CoreData.ConcurrencyDebug 1
Still, I don't think it hurts to have Nimble be a bit more safe with the notification threads.
Bumping this to the next (major?) release in favor of getting async/await support out the door sooner.