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

WineHQ Bugzilla wine-bugs at winehq.org
Tue Jan 12 14:39:36 CST 2021


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

--- Comment #14 from Bruni <earns.61 at gmail.com> ---
(In reply to forinih564 from comment #13)
> (In reply to Bruni from comment #6)
> > --quote--
> > [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Invoke
> > or BeginInvoke cannot be called on a control until the window handle has
> > been created.
> > --quote--
> > 
> > Maybe marshaled exception prevents Invoke from accessing the form thread.
> > 
> > Nikolay, could you please try to suppress the marshaled exception and post
> > renewed stacktrace?
> 
> I just noticed this message is printed only after attempting to close the
> program after the error messagebox shows
> 
> if i press continue to the error message then close the program , the
> message is printed to the console , the program closes but doesn't return
> control to terminal , i have to kill it via ctrl+c
> in this case the program is responsive (before closing it) & when pressing
> the button again, the same error message box appears
> 
> if i press quit , the message is printed however the program is still
> visible & unresponsive , i have to kill it via ctrl+c in terminal

This exception seems to be a consequence of the System.ArgumentException the
cause of which is yet to be identified.

Microsoft gave the same names to methods in COM objects and NET components.
To give an example, there is a method named CreateVistaDialog both in dotnet
/System/Windows/Forms/FileDialog_Vista.cs an in the COM object providing dialog
functionality.

Windows Forms (WinForms) is a UI framework for building Windows desktop
applications. It is a .NET wrapper over Windows user interface libraries, such
as User32 and GDI+ according to
https://github.com/dotnet/winforms/blob/master/README.md

So you have to find out whether you're in COM or NET part when debugging.
Different signatures may give you some guess.

Moreover, there is no managed code implementation for SetFileTypes with two
parameters in
https://referencesource.microsoft.com/#system.windows.forms/winforms/Managed/System/WinForms,
in https://github.com/dotnet/winforms,
in SetFileTypes https://github.com/mono/mono

When placed on a class, the ComImport attribute marks the class as an
externally implemented Com class. Such a class declaration enables the use of a
C# name to refer to a COM class.
A class that is decorated with the ComImport attribute is subject to the
following restrictions:

It must also be decorated with the Guid attribute, which specifies the CLSID
for the COM class being imported. A compile-time error occurs if a class
declaration includes the ComImport attribute but fails to include the Guid
attribute.
It must not have any members. (A public constructor with no parameters is
automatically provided.)
It must not derive from a class other than object. (from
https://www.c-sharpcorner.com/article/interface-components-interoperability/)

In comment 5 Nikolay said that SetFileTypes fails because filterItems is null,
and it should according to tests:
> ---
>         private void SetFileTypes(IFileDialog dialog)
>         {
>            COMDLG_FILTERSPEC[] filterItems = FilterItems;
>            HRESULT hr = dialog.SetFileTypes((uint)filterItems.Length, filterItems);
>            if (!hr.Succeeded())
>            {
>                throw Marshal.GetExceptionForHR((int)hr);
>            }
>---

There are two places where exceptions may be thrown due to filterItems being
null - filterItems.Length and dialog.SetFileTypes.

Failing tests means that wine does not expect FilterItems to return null.

Perhaps a testcase for FilterItems (both for COM and NET part) 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