[URGENT] Rhino 8 SR36 broke my plugin

After updating to Rhino SR36, my plugin AssembleRhino (it’s on the PackageManager) does not work anymore. When calling the command AssembleRhino, I get the following error message:

Summary

Compile Error
Assuming assembly reference 'System.Drawing.Primitives, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'RhinoCommon' matches identity 'System.Drawing.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Drawing.Primitives', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]
Assuming assembly reference 'RhinoCommon, Version=8.0.23304.9001, Culture=neutral, PublicKeyToken=552281e97c755530' used by 'AssembleRhino' matches identity 'RhinoCommon, Version=8.36.26293.11001, Culture=neutral, PublicKeyToken=552281e97c755530' of 'RhinoCommon', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]
The type 'IPointer<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.Windows.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. (Error CS0012) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[161:8]
Assuming assembly reference 'System.Collections.Specialized, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'RhinoCommon' matches identity 'System.Collections.Specialized, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Collections.Specialized', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]
The variable 'offsetMeshConduit' is declared but never used (Warning CS0168) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[62:32]
The local function 'DebugClash' is declared but never used (Warning CS8321) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[431:6]
The local function 'GetHandleIndex' is declared but never used (Warning CS8321) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[953:5]
The local function 'GetHandleTypes' is declared but never used (Warning CS8321) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[1019:7]
Error occured running command "46cf67ef-01de-4ff3-9805-6426bc8ea3bf" | Compile Error
Assuming assembly reference 'System.Drawing.Primitives, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'RhinoCommon' matches identity 'System.Drawing.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Drawing.Primitives', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]
Assuming assembly reference 'RhinoCommon, Version=8.0.23304.9001, Culture=neutral, PublicKeyToken=552281e97c755530' used by 'AssembleRhino' matches identity 'RhinoCommon, Version=8.36.26293.11001, Culture=neutral, PublicKeyToken=552281e97c755530' of 'RhinoCommon', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]
The type 'IPointer<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.Windows.Core, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. (Error CS0012) file:///C:/Users/aless/.rhinocode/stage/ndehnavd.m2g:[161:8]
Assuming assembly reference 'System.Collections.Specialized, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'RhinoCommon' matches identity 'System.Collections.Specialized, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Collections.Specialized', you may need to supply runtime policy (Warning CS1701) file:///:[1:1]

The same occurs if I run the uncompiled script from directly from the ScriptEditor
The first line of the script is:
// #! csharp
But it does not matter much, since the errors persist even if I delete it.
The error referring to the IPointer<> type appears on the InstalledFontCollection word on this part of the code:

// CHECK IF FONT EXISTS

using (InstalledFontCollection fontsCollection = new InstalledFontCollection())

{
    List<string> fonts = new List<string>();
    FontFamily[] fontFamilies = fontsCollection.Families;
    foreach (FontFamily font in fontFamilies)
        fonts.Add(font.Name);
    if (!fonts.Contains(fontFace))
    {
        string dialogText = "Please install *JetBrainsMono NFM* font for a better interface experience" + eol + eol + "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/JetBrainsMono.zip";
        Dialogs.ShowMessage(dialogText, frameMsg, ShowMessageButton.OK, ShowMessageIcon.Warning);
        fontFace = "Cascadia Mono";
        fontFaceAngle = fontFace;
    }
}

If, as the error suggest, I try to add using System.Private.Windows.Core;, I get the following error:
The type or namespace name 'Windows' does not exist in the namespace 'System.Private' (are you missing an assembly reference?) (Error CS0234)

If necessary, I can attach the whole script, but it’s quite extensive and I don’t know how to make a minimal version of it because, other than the bit I pasted above, I don’t know why it causes those errors.

It’s quite urgent, since this is a script my students use and they can’t go on without it. I cannot make them roll back to a previous version of Rhino either, unless you send me a direct link to the SR35.

Update: adding an explicit reference to System.Private.Windows.Core.dll, like so, fixes the problem temporarily:
#r "C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\10.0.12\System.Private.Windows.Core.dll"

EDIT
If I try to refer to it as a nuGet package, like so:
#r "nuget: System.Drawing.Common"

the script works. But I consider this a regression.

Can you post your SystemInfo output please?

Hi Alessio,

This isn’t a regression in Rhino, it’s a change in the .NET runtime. Rhino 8 SR36 moved from .NET 8 to .NET 10. Microsoft ends support for .NET 8 (and .NET 9) on November 10, 2026, after which they get no security fixes, so we moved Rhino 8 to the current long-term-support release, .NET 10, which Microsoft supports through November 2028:

In .NET 10, Microsoft changed System.Drawing.Common so that FontCollection / InstalledFontCollection depend on types in System.Private.Windows.Core, which is why the compiler now asks for that assembly. The line you found,

#r “nuget: System.Drawing.Common”

is the right fix: it pulls in the correct dependencies for whatever runtime Rhino is on, so it will keep working going forward. Please publish that update to the AssembleRhino package so your students pick it up through the Package Manager.

If you need to buy time before updating the package, Rhino 8 can still run on .NET 8: run the SetDotNetRuntime command, set NetCoreVersion to v8, and restart Rhino. Running SetDotNetRuntime again and choosing v10 switches back. I’d treat this as a short-term workaround only, since .NET 8 stops receiving security updates in a few weeks.

Hey @ale2x72,

Thanks for reporting the issue, Ideally plugins and scripts shouldn’t have to be changed. RH-99749 has been filed to dig into this to see if we can resolve it on our end.

Long story short; Rhino 8 references the runtime assemblies for compiling scripts which causes this issue. Rhino 9 already now uses the reference assembly packages for compilation instead which resolves it. I’m putting in a hot fix so we don’t break other scripts that use System.Drawing APIs in Rhino 8.

@ale2x72 I know you’ve already published an update to your plugin which resolves this for you. The changes you’ve made are good and should work fine going forward, but really should not have been necessary. Thank you again for letting us know about the issue, it really helps.

Cheers,
Curtis.

SystemInfo.txt (3.1 KB)

I did release the hotfix yesterday evening, so, crisis averted and thank you for your prompt reply, confirming my findings. Also, @curtisw, thank you for you reply and support.

I just found out that I spotted what in hindsight I can see is the same error while testing the plugin on Rhino 9 WIP in June: C# Script working in Rhino 8 causes error in Rhino 9 WIP

Back then, this error was already recognized as a consequence of the runtime change (and solved, according to the YouTrack). With the same runtime change applied to a SR, one would hope that a known and solved migration issue would not resurface.

It would be helpful, @ale2x72 , if you have a minute to spare, to test the 8.36 hotfix release with an older version of the plug-in. I have done this, but I get no further than There is no Layer named 'X_geom', after some activity (loading Python, Markdown). If the older version works correctly in the hotfix 8.36, that means anyone else having the same issue will no longer get the same error you got.

Make sure to uncheck “automatically update to the latest version” when testing this, and re-enable it after testing.

Sure, I can test that tomorrow and report back. Regarding the error you get, it is promising, since it works with a specific Rhino file setup (the plugin is conceived for my students in mind and it is organic within my course) and that message is one of the sanity checks it performs.

Sorry @menno, the test will have to wait as I ran into an issue after installing the latest SRC: [URGENT] Rhino 8 won't start after updating to SRC37

@menno I just tested on SRC37 and the error persists on my side if I comment the #r nuget line. Did you mean a different version by “8.36 hotfix”?

I did. 8SRC37 is one week old. You were installing v8.37.26293.10001, the last three digits in the third version number is the number of the day in the year, today is day 300, so your version is one week old.

You can try the version I sent a link for an a PM.

RH-99749 is fixed in Rhino 8 Service Release 36 Hot Fix 1