Solution Exception Traceback

HI all,

I’m working on my first Grasshopper plugin using C# and visual studio. I’m finding that when something goes wrong in my built component I get very minimal information - something like

“Solution Exception: Object Reference not set to an Instance of an Object”

without a traceback or any other information to help me locate the problem in my code. Is there any way to get more information about exactly where (i.e. what line of what file) a custom component fails?

Build a debug version of assembly and attach the debugger to Rhino.exe. Your IDE should capture that exception.

sorry to be dense, but what’s a debug version, and how do I attach it?

In VS click on the Debug tab, attach to process, find rhino in the search box and click on the attach button.

In “most” (kinda) of cases this is because you attempt to add something to a collection that is not defined (say a List, Array etc). Say hat you have a public List< object > objects and then in some line you do: objects.Add(something) prior defining the collection (i.e. objects = new List< object >(); )

Yeah I know, it can just get tedious to hunt down the error if I’ve done a large amount of coding before checking things in Grasshopper.

Thank you!