Rhino8 Windows.System.Forms.Form incorrect size

Hi

I have a Windows.System.Forms.Form which displays in Rhino6 and Rhino7 as the exactly size as is displayed in the Visual Studio designer. However the same plugin code shows this form in Rhino8 about 10% larger (so the widget sizes are not the same as in Rhino7). Is this a Rhino8 bug? Is there a work-around please?

Thanks

Paul

Hi @pkinnane,

Are you aware of this?

We’ll probably need more info - a screen capture and perhaps your plugin.

– Dale

Yes @dale - the plugin already scales for this. The issue is that on Rhino7 the Form shows as per Visual Studio, whereas on Rhino8 on the same PC it shows slightly larger.

Rhino7

Rhino8

Thanks

Paul

@dale - if I run Rhino8 from WITHIN Visual Studio (using the “/nosplash /netfx” command line arguments), the picture box is the CORRECT size. But if I then run from the Windows desktop, it is incorrect. So I cannot even debug this in the Visual Studio debugger, since it works correctly from there.

Thanks

Paul

Does this also use /netfx, or the default /netcore?

– Dale

@dale - when I start Rhino from the desktop, the icon’s Target is “C:\Program Files\Rhino 8\System\Rhino.exe” - does that answer your question?

Thanks

Paul

This means Rhino 8 starts with the default /netcore, which is different from what you use to debug. Remove the /netfx from your debug target to get the same behavior in Visual Studio.

Thanks @nathanletwory - If I start Rhino8 without the /netfx arguement,Rhino won’t start.

image

Paul

Change the debugger type to .net core.

Thanks @nathanletwory . I am a little lost with this. My project is .net 4.7 (since I need the executable to be compatible with Rhino7 too). The previous thread about this was Unable to start Rhino8 from Visual Studio 2022 for debugging

So I don’t believe I can change the debugger type to .net core in this instance.

Thanks

Paul

RhinoCycles is built against .NET Framework 4.8, but I can still debug using .NET Core. Rhino 8 by default runs .NET Core.

Thanks @nathanletwory . I really appreciate the help. However I am not sure that answers my original question. For clarity…when I run Rhino8 from the desktop (presumably .NET Core), the dialog widgets are not the same size as specified in Visual Studio.

Thanks

Paul

Would it be possible to get some assistance from the Rhine devs please? It looks to me to be a Rhino8 bug. I have even tried setting the MinimumSize and MaximumSize of the System.Windows.Forms.PictureBox, and it still displays as a larger size.

THanks

Paul

@curtisw - any ideas?

Any news on this from the Rhino devs please? It is a serious issue for my plugin. I have tried upgrading the project to .NET 7, and then tested it in Rhino8 and the problem persists. I need to get this sorted out please.

Thanks

Paul

Hi @pkinnane,

I’ve logged an issue so a dev can look into this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-83421

– Dale

Thanks @dale

Hey @pkinnane,

To debug using .NET Core with your .NET 4.7 project you must either multi-target your plugin project or create a .NET 7 launcher project, which is outlined here.

As for the different behaviour, this is likely due to the changes in Windows Forms in which might not behave the same in every way. You will need to update your code to account for these changes. If there are any bugs with Windows Forms, they can be reported on the winforms GitHub repo.

Hope this helps.

1 Like

Thanks @curtisw .

I have spent a huge amount of time on this, and been unable to resolve the core issue. I have upgraded the plugin to .NET 7 in VS2022 and in the form editor, the .NET7 version of the plugin shows larger widget sizes than in the .NET4 version - and for System.Windows.Forms.PictureBox widget no amount of hacking or tweaking settings will change the size (the other widgets are fine). I have given up trying to get the sizing to match between Rhino7 and Rhino8 and instead am scaling the bitmap that is being displayed in the PictureBox, which works.

I noticed is that I am now getting the following warning compiling the original Rhino7 version of my plugins:

NU1903: Package ‘Newtonsoft.Json’ 10.0.2 has a known high severity vulnerability, Improper Handling of Exceptional Conditions in Newtonsoft.Json · CVE-2024-21907 · GitHub Advisory Database · GitHub

Checking this error - it appears to be originating from Newtonsoft.Json.Rhino.dll in the Rhino7 folder. Is there any way to resolve this please?

Thanks

Paul

I’m glad you found a solution that works for you; if it becomes a problem we can try to help but would need to see a sample or the source code to troubleshoot further.

This would only be shown if your plugin, or a dependency of your plugin references the “Newtonsoft.Json” nuget package. Newtonsoft.Json.Rhino isn’t in that nuget package so it would not be the reason for this message. You can usually resolve this by explicitly adding a package reference to Newtonsoft.Json 13.0.1 or later.

Hope this helps!