# Efficient Plugin Debugging Routine with Visual Studio

**URL:** <https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480>\
**Category:** Grasshopper\
**Tags:** windows, scripting, csharp\
**Created:** [October 21, 2022, 3:43pm UTC](https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480 "2022-10-21T15:43:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivy/32/404249_2.png) [@Ivy](https://discourse.mcneel.com/u/Ivy)\
**Post date:** [October 21, 2022, 3:43pm UTC](https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480/1 "2022-10-21T15:43:35Z")

</div>

Hello everyone,

I am in the process of trying to improve my C# development routine and was wondering if there are any professional (C#) plugin developers here who are willing to share some knowledge or best practice about this topic.  
More specifically, I was wondering about the compiling / debugging process in Visual Studio. Originally, I worked in Visual Studio based on this tutorial: [Rhino - Your First Plugin (Windows)](https://developer.rhino3d.com/guides/rhinocommon/your-first-plugin-windows/#boilerplate-build). However, it involves restarting Rhino every time you change and rebuild your code, which tends to take quite some time.  
After some digging, I also found this workshop: [[Part 3/6] C# Scripting and Plugin Development for Grasshopper - YouTube](https://www.youtube.com/watch?v=hb32LgI4UJw). With the process presented there, you do not need to restart Rhino any more but only need to reopen your files, together with using the Rhino command “GrasshopperReloadAssemblies”.  
This is already a huge step towards faster debugging and testing for me, but I was wondering if there is an even better way of building your code and reloading the gha definition in Grasshopper. How do the professional plugin developers go about this in their every day life?

Besides that, if anyone has any other tips, tricks or useful resources about plugin development in C# to share, that is also always much appreciated!

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![mrhe](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mrhe/32/721627_2.png) [@mrhe](https://discourse.mcneel.com/u/mrhe)\
**Post date:** [October 21, 2022, 3:47pm UTC](https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480/2 "2022-10-21T15:47:14Z")

</div>

Start a debugging session from VS and use hot reload to force-push code changes.

Also, look into setting breakpoints in your code and stepping through the execution stack.

---

<div class="post-metadata">

**Author:** ![menno](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/menno/32/770384_2.png) [@menno](https://discourse.mcneel.com/u/menno)\
**Post date:** [October 21, 2022, 4:01pm UTC](https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480/3 "2022-10-21T16:01:59Z")

</div>

We use this method, also for .gha add-ins.

> [@How To Debug/Recompile Without Restarting Rhino](https://discourse.mcneel.com/t/how-to-debug-recompile-without-restarting-rhino/94141):
>
> I’ve seen a lot of threads about debugging and having to restart Rhino between sessions. I’m curious if there’s any updated tips and tricks as we knock on 2020’s door. Have the plugin act as a shim that dynamically loads assembly → Rebuild → Reattach to process? Anything with Rhino Inside?

---

<div class="post-metadata">

**Author:** ![Ivy](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivy/32/404249_2.png) [@Ivy](https://discourse.mcneel.com/u/Ivy)\
**Post date:** [October 24, 2022, 4:13pm UTC](https://discourse.mcneel.com/t/efficient-plugin-debugging-routine-with-visual-studio/149480/4 "2022-10-24T16:13:51Z")

</div>

Thank you two very much for the answers! I guess I would prefer the shim project approach over the force-pushes, to be on the save side. However, the shim also appears to be more complicated to implement for a beginner, since it has to be adapted to Grasshopper. @menno do you have any recommendations or code examples how to make this work for GH plugins?
