OpenDialog.Filter not working

Mac OS 10.9. I have a FileType AppFIle. It has a display name, UTI identifier, extension, and OS Type.

This used to work:

dlg = New OpenDialog
dlg.Filter = FileTypes.AppFile
f = dlg.ShowModal

In Xojo 2017r1 it doesn’t work. All files are grey in the open dialog, none are available. The filter isn’t working.

I checked one of the app files in the OS, using get information. I had to force “open with …” and choose the app, and then click the “change all” button. None of the files display the file icons like they used to. So I opened Terminal and rebuilt the Launch Services database. After doing that, when the open dialog shows, the app files display with icons, but they are still greyed out and unavailable. In the OS, the file icons still don’t display.

What’s going on?

This was a large issue that was discovered some time ago: <>
John and I discussed it with engineers at XDC.

This is the current (and working) workaround:

(This only applies to OpenDialog.Filter, and has nothing to do with which icon Finder is displaying)

Thank you, Tim. The workaround (defining the file type in the open method) works.

The problem with the icons may have to do with my system rather than Xojo, I don’t know. In any case, it’s not as important.

Defining it in the open event is unnecessary
For an IMPORTED TYPE you dont need to specify what it conforms to
For an EXPORTED type you do
See Greg & my notes on <> starting Nov 20

But creating the FileType in code immediately before using it doesn’t set up any ConformsTo and works perfectly?
I still don’t think I ever understood exactly what’s wrong, or why the fix I posted works every time.

Its not a “fix”
It requires you to recreate it many times rather than doing it once
God forbid you need to update them and you then have to update how much code ?
And its NOT required
Read the notes on the case from Nov 20 and onwards and Filetype sets work exactly as expected
We use them all over in the IDE and dont do anything like you keep telling people to do

I literally took 5 minutes created a new desktop app added a imported type for PDF and a new exported one for “foobar” type with .foobar extensions and manually created a new text file on the desktop with the .foobar extension WHILE the app was running and then pressed a button that had 3 lines of code in it and it allowed me to selected either PDF"s or my new Foobar type exactly as expected

FYI IF you are having issues with this MAKE SURE YOUR LAUNCH SERVICES DB gets reset from time to time

Different versions of the IDE can (& sadly did) have some entries that are messed up and this can lead to the launch services db being messed up in a way that filters may NOT seem to work as expected

I run into this one frequently because I do run everything from 2012 up to pre-alpha versions of 2017r3 hunting down bugs etc