Grasshopper

algorithmic modeling for Rhino

Debugging plugins without closing and reopening Rhino. (c#)

Hi GH people,

Now I am learning rhino SDK with c#.

Since the codes need to be compiled and loaded into Rhino before using them, it was hard to edit and test them. Whenever I need to change the code, I have to close Rhino, edit the code, recompile the code, reopen Rhino and run the plugin to see the result.

So, my question is...

Is there anyway to modify a code in VS and test it without closing and reopening Rhino? For instance, Revit provides an official plugin (plug-in manager) to dynamically load plugins, so that users do not have to close and reopen Revit to reload the plugins. I wonder if there is any intermediate plugin like this for Rhino. If there is not, can anybody suggest me how I can make that kind of bridging plug-in manager?

In advance, thank you!

Views: 2339

Replies to This Discussion

If there is I haven't found it. Restarting Rhino every time is what I do when debugging.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks, David!

If that is the only way to debug the code, I think I should live with it... at least until MS provides some good stuff.

Hi Woong,

In Rhino 4, using VS2008, it exists. It's called "Edit And Continue" and it's not too great, but it works.

It works

  • if you are not using Generics in the method you want to edit.
  • with some additional restrictions, like you cannot add fields and modify consts.
  • both for Rhino plug-ins and for Grasshopper addons (if the latter have memory load/COFF loading turned off).
  • if you start Rhino 4 through the debugger capabilities of VS2008.
  • when you load the right assembly -- that is the assmbly VS just compiled when you hit the "Debug" button, and not another assembly.

It does not work in VS2010 as they are not allowing reflection-loaded assemblies (plug-ins). I'm not sure about VS2012. Edit and Continue is a Microsoft-supported feature, so you should be able to use it in that setup. I did manage to use it, and the Wizards for components and plug-ins allow to use it, but it's not so easy to get it to work the first time on an already-built project, I must say. For Expression Editions, the instructions are here.

Please let me know if you have other questions.

- Giulio
_________________
giulio@mcneel.com

Hi Gulio,

Thanks for the kind reply. I am using Rhino 5 ans VS2010, so I cannot use edit and continue function. As you and David said, it seems there is no way to debug the code without reopening Rhino. (it is also seems hard even to debug the existing project, as you mentioned...)

Anyway, since I cannot use the "edit and continue"-like function in VS2010, now I am trying to make some plug-in manager, so that I can edit and run c# codes without closing and reopening it. Even if I succeed in make this plugin manager, I do not think that I can actually debug the code keeping Rhino open, but I will be more than happy if I can just try edited code without closing Rhino. I will post if I make it.

Thanks Gulio,
and Thanks David again.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service