Post

Replies

Boosts

Views

Activity

Reply to FileManager.trashItem(at:resultingItemURL:) never returns if called inside NSFileCoordinator.coordinate(writingItemAt:options:error:byAccessor:)
Did you ever solve this? I'm running into the same problem: FileManager.trashItem() deadlocks when wrapped in NSFileCoordinator.coordinate(writingItemAt:) on macOS Catalina. The code works fine on macOS Mojave. From the stacktrace, it looks like FileManager uses its own NSFileCoordination block and that can't get access to the file, because of the outer block: 2692 static MoveToTrashOperation.trashItem(:parentIsAttachmentsFolder:fileNamesOfFilesThatCanBeDeleted:changePropagator:) (in AppFramework) + 474 [0x10f497d0a] 2692 NSFileManager.coordinatedTrashItem(at:) (in AppFramework) + 711 [0x10fc12727] // This is my file access block: 2692 NSFileCoordinator.coordinate<A>(writingItemAt:options:byAccessor:) (in AppFramework) + 858 [0x10fc0deca] 2692 -[NSFileCoordinator coordinateWritingItemAtURL:options:error:byAccessor:] (in Foundation) + 91 [0x7fff35294473] 2692 -[NSFileCoordinator(NSPrivate) coordinateWritingItemAtURL:options:error:byAccessor:] (in Foundation) + 742 [0x7fff35294774] 2692 -[NSFileCoordinator(NSPrivate) withAccessArbiter:invokeAccessor:orDont:andRelinquishAccessClaim:] (in Foundation) + 531 [0x7fff3518b68f] 2692 _85-[NSFileCoordinator(NSPrivate) coordinateWritingItemAtURL:options:error:byAccessor:]blockinvoke.340 (in Foundation) + 219 [0x7fff353d165a] // A second time? 2692 _73-[NSFileCoordinator coordinateWritingItemAtURL:options:error:byAccessor:]blockinvoke (in Foundation) + 102 [0x7fff35294905] 2692 -[NSFileCoordinator invokeAccessor:thenCompletionHandler:] (in Foundation) + 143 [0x7fff35247b74] 2692 thunk for @escaping @calleeguaranteed (@inguaranteed URL) -> () (in AppFramework) + 141 [0x10fc0bf8d] 2692 thunk for @calleeguaranteed (@inguaranteed URL) -> () (in AppFramework) + 12 [0x10fc0beac] 2692 closure #1 in NSFileCoordinator.coordinate<A>(writingItemAt:options:byAccessor:) (in AppFramework) + 225 [0x10fc0e281] 2692 partial apply for closure #1 in NSFileManager.coordinatedTrashItem(at:) (in AppFramework) + 16 [0x10fc12b60] 2692 closure #1 in NSFileManager.coordinatedTrashItem(at:) (in AppFramework) + 363 [0x10fc1293b] 2692 -[NSFileManager trashItemAtURL:resultingItemURL:error:] (in Foundation) + 156 [0x7fff352d3f0c] 2692 -[NSFileManager(FPAdditions) fptrashItemAtURL:resultingItemURL:error:] (in FileProvider) + 454 [0x7fff3506ff1a] 2692 dispatchsemaphorewaitslow (in libdispatch.dylib) + 98 [0x7fff6ca04fbf] 2692 dispatchsema4wait (in libdispatch.dylib) + 16 [0x7fff6ca04aed] 2692 semaphorewaittrap (in libsystem_kernel.dylib) + 10 [0x7fff6cb9ee36]
Nov ’20