CoreData, Concurrency, and Background Context Confusion

I don't understand why Example 1 fails to compile and Example 2 compiles just fine in swift 6?

Note in the following examples that gDataController.container is an NSPersistentContainer

Example 1:

try await gDataController.container.performBackgroundTask { bkContext in
	try bkContext.save()
}

The Example 1 error is:

:cross_mark: Sending value of non-Sendable type '(NSManagedObjectContext) throws -> ()' risks causing data races

However Example 2 compiles just fine:

Example 2:

let bkContext = gDataController.container.newBackgroundContext()
try bkContext.performAndWait {
	try bkContext.save()
}

It would appear to me that these are exactly opposite of my expectations. Clearly in Example 2, bkContext is being passed into the closure.

Can anyone explain this?

Did you manage to find out a solution to getting the first to compile? I'd like to use that because it uses the async and it returns a value.

Nope, sometimes it works and sometimes it does not. I've not been able to figure out the magic sauce.

So I do this, which is probably wrong:

try await gDataController.container.performBackgroundTask { @Sendable bkMOC in