C# Script Editor Does Not Open

Hi,
I can’t open script editors for C# or VB components in RiR, while it’s possible to open script editors for GhPython components. Can I know why script editors are not working in RiR? I can open them outside Revit with no issues.

I can confirm that I have the same issue. Below is my github post.

Hi,

T is due a conflict with an other Revit addin.
In order to identify witch one is conflicting with the Grasshopper code editor, could you please follow the instructions here and tell us what you found.

This would help a lot to us to reproduce it here.
Many thanks.

1 Like

Hi @kike,

I’m sorry for this very late reply, but I finally tried the app to identify which Revit addin has a conflict today.
I disabled all the addins except RiR for Revit 2020 version, and I still couldn’t open the editor for C# component in Grasshopper.
Do I have to disable addins in other Revit versions, too?

With the official release of Rhino 7, our company is trying to eliminate issues before making Rhino 7 available. Currently, we have two issues.

  1. Unable to open the C# editor as reported to this post.
  2. Python conflict issue as reported to the post here. Priority: GhpyLoader Error on WIP 7 My colleague testing Rhino 7 also experiences this same issue.

It doesn’t seem easy to resolve these two issues. Do you have any good suggestions?
Thanks a lot!

@Dongyeop_Lee Do you see these errors in the standalone Rhino 7 as well or only in Rhino.Inside.Revit?

Hi @eirannejad, both issues are either in RiR or standalone Rhino 7, not in both.
Please see below.

Rhino.Inside.Revit: Unable to open C# editor, Python works fine (Issue #1 in my post)
Standalone Rhino 7: Python conflict, C# editor works fine (Issue #2 in my post)

Okay. Would you mind posting error messages from the python component in R7?

  1. Make sure to uninstall any Rhino WIP and install a fresh copy of Rhino 7. Confirm there is no C:\Program Files\Rhino WIP
  2. Do you see the error in Grasshopper only, or happes in EditPythonScript editor window as well?!
  3. Run the script below in EditPythonScript editor and share the results. I want to see which version of IronPython is loaded.
from System import AppDomain
print("Name,Version,Location")
for loaded_assembly in AppDomain.CurrentDomain.GetAssemblies():
    try:
        loc = loaded_assembly.Location
    except:
        pass
    assmname = str(loaded_assembly.GetName())
    if assmname.startswith('Microsoft') or assmname.startswith('Iron'):
        print(
            "{0},{1},{2}".format(
                loaded_assembly.GetName().Name,
                str(loaded_assembly.GetName().Version),
                loc,
            )
        )
  1. There is a Rhino WIP folder, but no files exist inside that folder. I believe Rhino WIP was uninstalled, when Rhino 7 was installed by our company IT.

  2. If I open the python editor directly from Rhino, it works. When I open Grasshopper initially, this error message appears.

Priority: GhpyLoader
{
  Failed to load language 'IronPython 2.7.9': Could not load type 'System.TypeExtensions' from assembly 'Microsoft.Scripting, Version=1.2.2.0, Culture=neutral, PublicKeyToken=xxxxxxxxx'.
  TargetInvocationException
}

Once Grasshopper is opened and I place a GhPython component in the canvas, I see two error messages from the component message balloon.

  • Before Solution exception
Failed to load language 'IronPython 2.7.9': Could not load type 'System.TypeExtensions' from assembly 'Microsoft.Scripting, Version=1.2.2.0, Culture=neutral, PublicKeyToken=xxxxx'.
  • Solution exception:Object reference not set to an instance of an object.
  1. I ran your script and I got this result.
Name,Version,Location
Microsoft.WindowsAPICodePack.Shell,1.1.0.0,
Microsoft.WindowsAPICodePack,1.1.0.0,
Microsoft.IdentityModel.Tokens,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.Tokens.dll
Microsoft.IdentityModel.Logging,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.Logging.dll
Microsoft.IdentityModel.JsonWebTokens,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.JsonWebTokens.dll
Microsoft.GeneratedCode,1.0.0.0,C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_12.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
Microsoft.Scripting,1.2.2.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\Microsoft.Scripting.dll
IronPython,2.7.9.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\IronPython.dll
Microsoft.Dynamic,1.2.2.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\Microsoft.Dynamic.dll
IronPython.Modules,2.7.9.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\IronPython.Modules.dll

Thanks a lot for taking your time to look into these issues!

1 Like

@Dongyeop_Lee Do you have a C:\IronBug directory or any of the LadyBugTools installed?

@eirannejad, yes, I have both Ironbug and ladybug directories in my C drive.

I’m happy to report that the python conflict issue is gone on my computer after installing the latest Rhino 7.1 version. I still can’t open C# editor in Grasshopper inside Revit. C# components made outside Revit function properly inside Revit, but I just can’t edit them inside Revit.

1 Like

Great. Now that we can use the python component, let’s open this definition and list the loaded assemblies in memory. Make sure to run this after adding a C# component and generating the error. I want to see which DLLs where loaded by the C# component as this is potentially a dll conflict

Inspect.gh (3.4 KB)

Thank you @eirannejad, I’ve just sent you a message of the output I got from your file. Just to be clear, I don’t get any error messages using C# components inside Revit. I just can’t open the C# editor inside Revit, while I can do so outside Revit, in standalone Rhino.

1 Like

@Dongyeop_Lee I suspect the culprit is the AutoGraph addon installed under %APPDATA%/Grasshopper/Library/AutoGraph. The latest version of this addon is for Rhino 6 and it should be installed under the %APPDATA%/Grasshopper/6/Library path. Under the current path it also loads under Rhino 7 and especially in Rhino.Inside.Revit. This creates a dll conflict with Rhino’s and AutoGraph’s versions of QWhale.Editor.dll assembly. This is the code editor that the C# and VB.Net components are using.

I installed AutoGraph on my machine and can confirm the exact problem happening on mine as well.

If you need the addon, a workaround is to delete the DLLs listed below from %APPDATA%/Grasshopper/Library/AutoGraph. This will force loading the Rhino’s version of the DLLs that do not cause conflicts with Grasshopper:

QWhale.Editor.dll
QWhale.Syntax.dll
QWhale.Syntax.Parsers.dll
QWhale.Common.dll

That’s it! Thanks so much @eirannejad !!

1 Like

@eirannejad, I somehow got the python conflict issue back today, and repairing Rhino 7.1 didn’t work it out. Did you find anything suspicious in the message that I got before by running your python script?

Name,Version,Location
Microsoft.WindowsAPICodePack.Shell,1.1.0.0,
Microsoft.WindowsAPICodePack,1.1.0.0,
Microsoft.IdentityModel.Tokens,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.Tokens.dll
Microsoft.IdentityModel.Logging,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.Logging.dll
Microsoft.IdentityModel.JsonWebTokens,6.5.0.0,C:\Program Files\Enscape\Bin64\Microsoft.IdentityModel.JsonWebTokens.dll
Microsoft.GeneratedCode,1.0.0.0,C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Newtonsoft.Json\v4.0_12.0.0.0__30ad4fe6b2a6aeed\Newtonsoft.Json.dll
Microsoft.Scripting,1.2.2.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\Microsoft.Scripting.dll
IronPython,2.7.9.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\IronPython.dll
Microsoft.Dynamic,1.2.2.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\Microsoft.Dynamic.dll
IronPython.Modules,2.7.9.0,C:\Program Files\Rhino 7\Plug-ins\IronPython\IronPython.Modules.dll

This is the message I get when I launch Grasshopper in standalone Rhino 7.


I can open the GhPython editor without any issues with RiR.

Did you remove the C:\IronBug ? I have seen this happen many times due to a conflict with this addon

Thanks again @eirannejad! As soon as I removed Ironbug, the issue was gone.

1 Like