Grasshopper

algorithmic modeling for Rhino

Hi David-

I'm in VStudio debugging some grasshopper code which uses a mixture of C# code as "scripted" components and some real C# development (which is what I'm trying to debug).  As I'm messing around I sometimes end up disconnecting and feeding erroneous inputs into my C# component.  Something that causes a null reference in the script.  Which throws an exception.  

All that's fine- the problem I have is that the exception doesn't get handled anywhere so it tries to break in the Visual Studio debugger which makes it ask for source files etc etc.

I can solve my problem if I always wrap my c# routine in a try/catch and toss the exceptions away.  But it might be better if Grasshopper actually handled any exceptions thrown out of the user code and pass the message onto the component message box.   

Cheers-

    - B -

Views: 1012

Replies to This Discussion

It should. The entire user script runs inside a Try-Catch block. In fact every single component SolveInstance() method runs inside its own Try-Catch block as any crash inside SolveInstance would bring down Rhino+Grasshopper.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David - Is there a place in the SDK or RhinoCommon that can be referred to for error / exception catching etc? 

I don't understand. 'referred to' what? 

Grasshopper and RhinoCommon use standard .NET exceptions and try...catch blocks.

--

David Rutten

david@mcneel.com

David,

As a beginner it's sometimes difficult to work this stuff out, but I've managed to - thanks for the reference.

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service