Weird error: InstantiateT() cannot be called if T is an abstract type

I’ve not seen this error before, but it pops up sometimes. It doesnt affect the running of the script, so im guessing its a UI error?

Having the same error pops up every time when I initiate GH after installing the SR22 update.

Hi - could you please run the Rhino SystemInfo command and copy-paste the result here?

1 Like

Hi Wim,

here it is:

Rhino 6 SR22 2020-1-28 (Rhino 6, 6.22.20028.13281, Git hash:master @ 379871ece695dc096e83826f08b429db8ca2e7f5)
License type: Commercial, build 2020-01-28
License details: LAN Zoo Network Node

Windows 10.0 SR0.0 or greater (Physical RAM: 32Gb)
Machine name: LDNLT5CD9073W0B

Non-hybrid graphics.
Primary display and OpenGL: NVIDIA Quadro P1000 (NVidia) Memory: 4GB, Driver date: 6-3-2019 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 431.02

Secondary graphics devices.
DisplayLink USB Device (Unknown) Memory: 0MB, Driver date: 3-1-2019 (M-D-Y).
DisplayLink USB Device (Unknown) Memory: 0MB, Driver date: 3-1-2019 (M-D-Y).

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: Height

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 6-3-2019
Driver Version:
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 4 GB

Rhino plugins
C:\Program Files\Rhino 6\Plug-ins\Commands.rhp “Commands” 6.22.20028.13281
C:\Program Files\Rhino 6\Plug-ins\WebBrowser.rhp “WebBrowser”
C:\Program Files\Rhino 6\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 6\Plug-ins\RhinoScript.rhp “RhinoScript”
C:\Program Files\Rhino 6\Plug-ins\AnimationTools.rhp “AnimationTools”
C:\Program Files\Rhino 6\Plug-ins\IdleProcessor.rhp “IdleProcessor”
C:\Program Files\Rhino 6\Plug-ins\Tibidabo\Tibidabo.rhp “Tibidabo”
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Speckle Rhino Plugin (512d9705-6f92-49ca-a606-d6d5c1ac6aa2)\SpeckleWinR6.rhp “Speckle Rhino”
C:\Program Files\Rhino 6\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 6.22.20028.13281
C:\Program Files\Rhino 6\Plug-ins\rdk_ui.rhp “Renderer Development Kit UI”
C:\Program Files\Rhino 6\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 6\Plug-ins\Alerter.rhp “Alerter”
C:\Program Files\Rhino 6\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 6.22.20028.13281
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\6.0\Plug-ins\Lumion LiveSync for Rhino (839d6175-32d1-4ffe-a0a4-b7fb43cf0ff5)\2019.6.17.913\Lumion\Rhino 6.0\LumionPlugin.rhp “Lumion LiveSync for Rhino”
C:\Program Files\Rhino 6\Plug-ins\RhinoCycles.rhp “RhinoCycles” 6.22.20028.13281
C:\Program Files\Rhino 6\Plug-ins\Tibidabo\VisualARQ.rhp “VisualARQ”
C:\Program Files\Rhino 6\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 6.22.20028.13281
C:\Program Files\Rhino 6\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 6.22.20028.13281
C:\Program Files\Rhino 6\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Chaos Group\V-Ray\V-Ray for Rhinoceros 6\VRayForRhino.rhp “V-Ray for Rhino”
C:\Program Files\Rhino 6\Plug-ins\Displacement.rhp “Displacement”
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\packages\6.0\ColorPicker\6.0.0\ColorPicker.rhp “ColorPicker”
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\packages\6.0\iris\0.6.6\Iris.WinR6.rhp “Iris”
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\packages\6.0\PanelingTools\2018.12.17+906\PanelingTools.rhp “PanelingTools”
C:\Users\Pei-Chin.lin\AppData\Roaming\McNeel\Rhinoceros\packages\6.0\rhino-render-next\0.0.2\RhinoRenderNext.rhp “Rhino Render Next”

Hi Pei Chin - what happens when you launch Rhino in safe mode and then launch Grasshopper without loading any definition? Does that also throw up that error?

Hi Pei Chin - also see this post by @Dani_Abalde:


Many thanks Wim,
Tried uninstalling plus-ins through CLI tool via Yak.
Problem solved after uninstalling “samplepy_axes” plug-in.
Hope this help others with the same problem.

Pei Chin


was your “samplepy_axes” a ghpy plugin ?
I wonder if this error is related to ghpy.

Yes, I have the same suspect.
I’ve tested several different plug-ins which contains ghpy file would cause the same error.

@piac Hi there, we have some users in our computer who are using ghpy to compile components and have met this error. Although its not breaking workflows, it is lowering confidence in our components. Do you know whether this is related to ‘how’ ghpy is compiled, or where we might go to resolve this?

This error means, that at some point Grasshopper tries to initiate an interface by reflection mechanism. But obviously you can only instantiate concrete classes, and not abstract classes or interfaces. If reflection is used this error only occurs on runtime. I’m guessing someone is creating interface definitions at a place where only concrete implementation should be created…

Thank you

Hi @yun.sung

I doubt this has to do something directly with Ghpy. Ghpy files are supposed to contain only GH_Component-derived classes, and not Param-derived classes. However, I cannot know what code is executing here, and basically anything that can be done in C# can also be done in IronPython.

I’d look for places where you try to override right-click behavior? Maybe. You’ll need to provide a repeatable code sample for me to be able to reproduce and help.

Do you, by any chance, have a complex inheritance mechanism for some components or parameters?



Giulio Piacentino
for Robert McNeel & Associates

I tried to use the simplest example only one line rs.AddLine(x,y) and compile .ghpy still shows this error, so obviously this is a .ghpy bug…please check.

Can you provide the pre-compiled python component script here?

it’s just rs.AddLine(x,y)…

from ghpythonlib.componentbase import executingcomponent as component
import Grasshopper, GhPython
import System
import Rhino
import rhinoscriptsyntax as rs

class MyComponent(component):

def RunScript(self, x, y):
    a = rs.AddLine(x,y)
    # return outputs if you have them; here I try it for you:
    return a

try a = Rhino.Geometry.Line(x,y) instead.

(Make sure you import Rhino before that)

Have this being resolved? We encountered the same error and it seems it happens only when we have a particular .gha library (Speckle 1.0) along with a ghpy library. So I think like @jason.chen showed that the contents of the ghpy, do not matter but the fact that you have a ghpy, means you are triggering some compilation of the .gha components but it fails?

What I am trying to investigate and I would appreciate if anyone has done this before is which part might cause this. I would look in the constructors of the GH_Component as those get called are there any others?

ok so I fixed it on our end it was a bit of a process to figure out which element was causing it.

The specific issue was that a custom GH_Goo didn’t have a parameter-less constructor as the Error suggests. So if you have something like that look through you GH_Goo custom classes and create one.

In my case this GH_Goo was used in a custom parameter that was associated in an output of a component. So this gets called when GH launches. Find some snippets below.

This needed Param_SpeckleStreams

public class ListStreams : GH_Component
  protected override void RegisterOutputParams(GH_OutputParamManager pManager)
      pManager.AddParameter(new Param_SpeckleStreams(), "streams", "S", "Streams that you own or are shared with you.", GH_ParamAccess.list);

This needed GH_SpeckleStream

public class Param_SpeckleStreams : GH_PersistentParam<GH_SpeckleStream>

And this was missing a default constructor

  public class GH_SpeckleStream : GH_Goo<SpeckleStream>
    // I've added this
    public GH_SpeckleStream()
      Value = null;

Even though this is fixed from this end, I am still confused why it only happens if you have a ghpy file. Grasshopper goes through the same process while launching and doesn’t cause these errors. My guess is that the triggered compilation is not in parity with the default compilation that GH is doing. Hope this makes sense / helps someone!


When no constructor is defined you can still do:

var obj = new MyClass()

→ works, but it is a tricky statement. It indicates that there is a constructor, but there is no.

Type t = typeof(MyClass);
MyClass obj = (MyClass)Activator.CreateInstance(t);

→ throws, because there is no constructor specified.

MyClass obj = (MyClass)FormatterServices.GetUninitializedObject(typeof(MyClass));

→ works like the second but does not call ctor it just keeps all members in uninitialized state. You can manually assign them field by field, property by property.

So at some point GH, maybe in the Python implementation uses the second approach to initialize.
Anyway, I would always provide a parameterless(=default) constructor to a class, if the class can also be initialized without arguments or when no constructor is needed. If this should not be allowed (there are reasons for this, just create an empty ctor and set the access modifier to private. Its actually good that the second throws, because some objects just don’t work properly if they are not correctly initialized.
E.g. A file logger needs a reference to a location on your harddrive. If this wouldn’t be set on construction, the logger couldn’t log to any file if a path was never set. So if someone uses reflection to initialize such an object, this person might miss to set a path and wonders why nothing happend. A file logger might only accept a constructor with a filepath as parameter, while the empty one is set to private (don’t need to be done if at least one constructor with arguments has been specified - it will not allow to compile the first example then). Of course you can design things differently to catch these shortcommings, but it might explain why things are like this.)

1 Like