COM Cast Exception when navigating directories

Nov 1, 2013 at 9:49 AM
Greetings.

I'm implementing your control and have run into a situation when I attempt to use it such that I can select a file. When I navigate through the directory structure on the left it will sometimes fire off the following exception:

Unable to cast COM object of type 'System.__ComObject' to interface type 'Shell32.Shell'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{286E6F1B-7113-4355-9562-96B7E9D64C54}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

If I click carefully and drill down to the directory I want which contains the file type that I have specified in my filter it will do the same.

I'm fairly new to using C# with respect to MVVM as well as implementing new third party controls. Perhaps I've missed something. Here is the code that I have used which comes from your implementation example.
        string strFileName = string.Empty;
        // Initializing Open Dialog
        Gat.Controls.OpenDialogView openDialog = new Gat.Controls.OpenDialogView();
        Gat.Controls.OpenDialogViewModel vm = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

        // Adding file filter
        vm.AddFileFilterExtension(".xml");

        // Show dialog and take result into account
        bool? result = vm.Show();
        if (result == true)
        {
            // Get selected file path
            strFileName = vm.SelectedFilePath;
        }
Any help you can provide would be great.

Regards,

Jon
Coordinator
Nov 3, 2013 at 12:58 AM
Hi Jon,

thank you for your feedback.

This seems to be a bug in the library. The new version 1.1.1 should hopefully solve this problem.

Best regards,

Chris
Nov 3, 2013 at 1:01 AM
Great.

Thanks for letting me know. I'd like to use your Dialog to replace both the file and folder implementations I currently have. I need to investigate what yours has to offer more though.

Thanks again,

Jon