[Bug 50042] Vista+ style file dialogs fail to open with wine-mono

WineHQ Bugzilla wine-bugs at winehq.org
Thu Dec 17 16:02:59 CST 2020


https://bugs.winehq.org/show_bug.cgi?id=50042

--- Comment #8 from Bruni <earns.61 at gmail.com> ---
Nikolay

What say?

GetExceptionForHR is a way to convert HRESULT error into an exception.
Exceptions propagate through stack up to the entry point until some code
catches them.

Microsoft implies the aim of GetExceptionForHR is to create exceptions that are
not to be caught.
See
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getexceptionforhr?view=netcore-3.1#System_Runtime_InteropServices_Marshal_GetExceptionForHR_System_Int32_System_IntPtr_

This bug means the absence (or unfitness) of a catch block.

Microsoft do not seemingly specify any GetExceptionForHR call in
winforms\Managed\System\WinForms\FileDialog_Vista.cs as well.
See
https://referencesource.microsoft.com/#system.windows.forms/winforms/Managed/System/WinForms/FileDialog_Vista.cs
This is how SetFileTypes looks on that page:

private void SetFileTypes(FileDialogNative.IFileDialog dialog)
    {
        FileDialogNative.COMDLG_FILTERSPEC[] filterItems = FilterItems;
        dialog.SetFileTypes((uint)filterItems.Length, filterItems);
            if (filterItems.Length > 0)
            {
                dialog.SetFileTypeIndex(unchecked((uint)filterIndex));
            }
        }
    }

So it seems native .NET gets by without a marchaled (and uncatchable) exception
in SetFileTypes.

There may always be something left out of account but some explanation of
`throw Marshal.GetExceptionForHR((int)hr);` is needed.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list