Strange Overlay with NSWorkspace.shared.icon(forFile: )

I am currently experiencing strange behavior when determining icons for files. When I determine icons using

let icon = NSWorkspace.shared.icon(forFile: path)

it generally works fine. However, for some files, a "denied" symbol appears as an overlay. When I look at the corresponding icon in the debugger, a Decorated-Icon with the decoration "com.apple.icon-decoration.system.unsupported" is determined. In Finder, Dock, or other programs, the symbol is displayed correctly.

In the case mentioned, it is a website that has been converted into an app using the "Unite" application.

Why is NSWorkspace.shared.icon(forFile: path) determining this overlay and is there a way to get the "normal" icon?

Personally, I think it's a SwiftUI bug. I have a similar problem with the ImageRenderer class and get the same symbol. I've filed a feedback report. It's been 5 or 6 weeks. When I filed a bug report 9 or 10 years ago regarding Core Graphics, I had to wait for 3 months. If possible, you may write code in Cocoa and use it as NSViewControllerRepresentable or NSViewRepresentable.

Strange Overlay with NSWorkspace.shared.icon(forFile: )
 
 
Q