8.7 is missing method get_IsMouseCaptured in PanelHandler

Our software is no longer able to load our plugin, with Rhino 8 SR7. It seems the Eto.Wpf assembly doesn’t have a property for IsMouseCaptured on Eto.Wpf.Forms.Controls.PanelHandler.

We are receiving this exception:

System.TypeLoadException
  HResult=0x80131522
  Message=Method 'get_IsMouseCaptured' in type 'Eto.Wpf.Forms.Controls.PanelHandler' from assembly 'Eto.Wpf, Version=2.7.0.0, Culture=neutral, PublicKeyToken=552281e97c755530' does not have an implementation.

Problem also occurs with Rhino 8 SR 8.

Hey @jstevenson,

We have not removed that property, and it should still be in 8.8 (and onwards). It is inherited from WpfFrameworkHandler here.

One thing that might be going on is that there may be multiple Eto.Wpf.dll’s being loaded, if you have referenced the Eto.Platform.Wpf nuget package. If you do, ensure your plugin does not include Eto.Wpf.dll or Eto.dll.

Also, I’d recommend relying on the APIs in Eto.dll, e.g. Eto.Forms.Control.IsMouseCaptured instead of using APIs from Eto.Wpf.

Curtis,

Thank you for the quick reply. We aren’t doing any manual referencing of ETO stuff, we just have had this one method to override some of the Rhino UI control colors that’s been working fine in Rhino 7 and Rhino 8.0-8.6 , but now in R8 SR7 it now gives the above exception.

public static void SetETOColors()
{
    var etoForeground = Eto.Drawing.Color.FromArgb(ColorHelper.Color_12.R, ColorHelper.Color_12.G, ColorHelper.Color_12.B, ColorHelper.Color_12.A);
    var etoBackground = Eto.Drawing.Color.FromArgb(ColorHelper.Color_02.R, ColorHelper.Color_02.G, ColorHelper.Color_02.B, ColorHelper.Color_02.A);
    var etoBackgroundLight = Eto.Drawing.Color.FromArgb(ColorHelper.Color_04.R, ColorHelper.Color_04.G, ColorHelper.Color_04.B, ColorHelper.Color_04.A);

    System.Windows.Media.SolidColorBrush backgroundColor = new System.Windows.Media.SolidColorBrush(ConvertEtoColor(etoBackground));
    System.Windows.Media.SolidColorBrush backgroundColorLight = new System.Windows.Media.SolidColorBrush(ConvertEtoColor(etoBackgroundLight));
    System.Windows.Media.SolidColorBrush foregroundColor = new System.Windows.Media.SolidColorBrush(ConvertEtoColor(etoForeground));
    System.Windows.Media.SolidColorBrush menuBarBackgroundColor = new System.Windows.Media.SolidColorBrush(ConvertEtoColor(etoBackground));

    Eto.Style.Add<Eto.Wpf.Forms.Controls.PanelHandler>(null, panel =>
    {
        panel.BackgroundColor = etoBackground;
    });
    Eto.Style.Add<Eto.Wpf.Forms.Menu.ButtonMenuItemHandler>(null, handler =>
    {
        handler.Control.Foreground = foregroundColor;
        handler.Control.Background = menuBarBackgroundColor;
    });
    Eto.Style.Add<Eto.Wpf.Forms.Menu.MenuBarHandler>(null, handler =>
    {
        handler.Control.Foreground = foregroundColor;
        handler.Control.Background = menuBarBackgroundColor;
    });
    Eto.Style.Add<Eto.Wpf.Forms.Menu.CheckMenuItemHandler>(null, handler =>
    {
        handler.Control.Foreground = foregroundColor;
        handler.Control.Background = menuBarBackgroundColor;
    });
}

We have compiled against these Rhino 8.0.23304.9001 RhinoCommon, Grasshopper, and RhinoWindows NuGet packages.

I see those properties were just added 4 months ago, not sure if that is helpful to understand what is going on here…

It looks like there is an Eto.dll and an Eto.Wpf.dll that is being copied to the bin folder of a few projects that reference RhinoWindows nuget package.

And if I manually delete that file, it then correctly uses the one from the Rhino folder as expected.

So we now have to add post-build steps to clean out those files, seems like there must be something wrong with the RhinoWindows NuGet spec file or something that is setting copy local to true for those dlls.

We had to add this to each of our projects to fix this issue:

ECHO -----------------------------
ECHO Delete Eto/Eto.Wpf.dll from BIN Folder
ECHO -----------------------------
DEL "$(TargetDir)\Eto.*.dll"

I’m not sure how your projects are set up (sdk-style,old-style), whether you’re using packages.config or PackageReference, etc. But usually with PackageReference if you do this it shouldn’t copy any references:

<PackageReference Include="RhinoCommon" Version="8..." />
<PackageReference Include="RhinoWindows" Version="8..." />

If you specify any IncludeAssets/ExcludeAssets/PrivateAssets attributes, they may be copied depending on what you set.

You can manually ensure those won’t be copied by using this instead:

<PackageReference Include="RhinoCommon" Version="8..." IncludeAssets="compile;build" />
<PackageReference Include="RhinoWindows" Version="8..." IncludeAssets="compile;build" />

Hope this helps!

2 Likes

Adding that to each of our Rhino NuGet package references fixed our issue. Thank you for digging into this, we really appreciate your help!