Attachment is displayed incorrectly

In the recent MacOS Sequoia Beta 3 NSTextAttachment initialized with custom data and an Image cell as attachmentCell are shown as a file icon istead of the image cell.

I am creating a NSAttributedString and showing it in NSTextView like this:

NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithData:[text dataUsingEncoding:NSUTF8StringEncoding] ofType:nil];
    attachment.attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:img];
    
    NSMutableAttributedString *res = [[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
...
Attachment is displayed incorrectly
 
 
Q