Issue when listing Trash content with macOS Monterey beta

Since the release of the first beta of macOS Monterey, I've got an issue while listing the content of the Trash.

I've got a sandboxed app with User Selected File entitlement, I select my User Home folder in an Open dialog box, then I try to list the content of the Trash, but it's empty (whereas it's not!). Even with Full Disk Access given, the content is still empty.

if let trashURL = try? FileManager.default.url(for: FileManager.SearchPathDirectory.trashDirectory, in: .userDomainMask, appropriateFor: nil, create: false) {
   
    if let content = try? FileManager.default.contentsOfDirectory(at: trashURL, includingPropertiesForKeys: nil, options: []) {

          print(content)

    }

}

It was working fine in macOS Big Sur. Getting Full Disk Access was sufficient to list the content of the Trash.

Is there any change?

Whooo just discovered there's something wrong with the Trash! When I use the Finder to move files to the Trash, they don't go to /Users/myusername/.Trash (as usual) but in /Users/myusername/Library/Group Containers/group.com.apple.Photos.PhotosFileProvider/File Provider Storage/photospicker/.Trash

That's why my code is not working. Can't find a way to get rid of this bug...

This is also happening to me on Big Sur.

Found a fix?

Issue when listing Trash content with macOS Monterey beta
 
 
Q