Core Data apps no longer working after update to iOS27

I have two apps that both use Core Data. Since updating to XCode 27.1 and iOS 27 one works and one does not. Both apps have AppDelegates, SceneDelegates and CoreDataStacks that are the same, except for data entity names, etc.

With App A, this works:

extension StartViewController {

func importJSONPlaceSeedDataIfNeeded() {
    
    let fetchRequest: NSFetchRequest<Places> = Places.fetchRequest()
    let count = try? coreDataStack.context.count(for: fetchRequest)
    
    guard let placeCount = count,
          placeCount == 0 else {
        return
    }
    
    importJSONPlaceData()
}

With App B, this does not work:

extension StartViewController {

func importBirdsJSONSeedDataIfNeeded() {
    
    let fetchRequest: NSFetchRequest<Birds> = Birds.fetchRequest()
    let count = try? coreDataStack.context.count(for: fetchRequest)
    
    guard let birdCount = count,
        birdCount == 0 else {
            return
    }
    
    importBirdsJSONData()
}

I get the error: Kafue_Birds/StartViewController.swift:77: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value

The line that throws the error is: 

 let count = try? coreDataStack.context.count(for: fetchRequest)


 Any suggestions?