I found a solution
If you add a @Sendable the warning will disappear
func foo()async throws {
let ctx = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType);
//..
try await ctx.perform{ @Sendable in // warning disappear
if ctx.hasChanges {
try ctx.save();
}
}
}