NSSharingService.perform() with Send To Photos

On MacOS (catalyst app, but AppKit bundle) I am creating Share submenu in main app menu "on fly" from menu delegate like this:

func menuWillOpen(_ menu: NSMenu) {

    self.provider = NSItemProvider(contentsOf: url)! //url points to existing temporary file of type .png
    
    menu.removeAllItems()
    let srvcs = NSSharingService.sharingServices(forItems: [self.provider!])
    for srv in srvcs {
        let it = NSMenuItem(title: srv.menuItemTitle, action: #selector(openSharingService), keyEquivalent: "")
        it.image = srv.image
        it.representedObject = srv
        it.target = self
        
        menu.addItem(it)
    }
}
@objc private func openSharingService(sender: NSMenuItem) {
    let service = (sender.representedObject as! NSSharingService)
    service.perform(withItems: [self.provider!])
}

It works well for any share type, except for Send To Photos. With Send To Photos, I am getting this error in console:

> 
2021-10-27 08:59:02.042220+0200 Calculator2[14383:7732689] [xpc.exceptions] <NSXPCConnection: 0x6000008470c0> connection to service on pid 14388 named com.apple.share.System.add-to-iphoto.apple-extension-service: Exception caught during decoding of received selector _completeRequestReturningItems:forExtensionContextWithUUID:completion:, dropping incoming message.
Exception: Exception while decoding argument 0 (#2 of invocation):
Exception: value for key 'NS.objects' was of unexpected class 'NSURL (0x7fff801889e8) [/System/Library/Frameworks/CoreFoundation.framework]'. Allowed classes are '{(
    "NSDate (0x7fff80188600) [/System/Library/Frameworks/CoreFoundation.framework]",
    "NSString (0x7fff801ba8d0) [/System/Library/Frameworks/Foundation.framework]",
    "NSNumber (0x7fff801ba3a8) [/System/Library/Frameworks/Foundation.framework]",
    "NSData (0x7fff801885d8) [/System/Library/Frameworks/CoreFoundation.framework]",
    "NSDictionary (0x7fff80188650) [/System/Library/Frameworks/CoreFoundation.framework]",
    "NSArray (0x7fff80188510) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'.

Photos app is opened and image is added to it, but my app recieves the above error and its menus are all grayed out until restarted. Am I doing something wrong here?

NSSharingService.perform() with Send To Photos
 
 
Q