Visual Studio 2022 - Debugging issues with Rhino GH VB templates

Hi All,
I’m coming back to component development after 4 years, and having some trouble with Visual Studio 2022 with debugging linking back to Grasshopper.

I am using the VB version of the templates, as I’m not familiar with C#. Others seem to be having this same issue - but the fixes seem specific to C - unless I’m mistaken.

Following this guide: Rhino - Your First Component (Windows)

I have:

  1. Downloaded and installed Visual Studio 2022 and the .Net extensions.
  2. Located the Grasshopper Assembly templates and installed.
    image
  3. Created a new project following the instructions, and including sample code.

From here, whether I write my own code - or try and run/debug I get the following error:

image

From what I have read - it would appear the template is not correctly linking through to the Rhino and/or grasshopper EXE’s?

I’ve tried a bunch of different things with no success. I did find if I right click on my solution, goto properties and into debug I can get to a ‘debug launch profiles UI’ - bumbling around I’ve managed to get the debug to open Rhino - but it doesn’t open grasshopper, or run.

If anyone can advise I would be be most appreciative :slight_smile:

Kind Regards
Lyndon

Hi Lyndon,

First off, you have to set up an executable debug profile. In your Launch Profiles window, create a new profile with type “Executable”. Then you can set the path to Rhino.exe.
2024-03-11_09-38-58

Next, there are a couple ways to get Grasshopper to run automatically. You can set up Rhino to run the “_Grasshopper” command every time it opens by going to Rhino Options > General > Command Lists.

I find this kind of annoying because you don’t always want GH to run every time you open Rhino. Instead you can pass commands to Rhino through your debug profile. There are a number of command line arguments you can play with (see full list here).

In this instance I am opening with the following sequence of commands:

  • Run Rhino with .NET Framework because the plugin I’m working on needs some attention to use the .NET Core default.
  • Skip showing the splash page for templates/recent saves/etc.
  • Open my working development .3dm file.
  • Open Grasshopper and then load my working development .gh file.

There is also one additional setup step you have to do. In order for Grasshopper to be able to read your compiled debug file, you have to point Rhino to the “bin” folder in your repo by running the GrasshopperDeveloperSettings command. You only have to do this once for each plugin. Then, the next time Visual Studio opens Rhino, Grasshopper should start automatically and your plugin will appear.

2024-03-11_09-34-06

Hope that helps.

1 Like