How to exit the c# plugin command properly?

Hi, everyone! I am writing a c# plugin. Under some specific circumstances, I need the plugin command to exit and raise a warning message box. However when I tried Environment.Exit(0), the plugin command exits but the rhino window seem to freeze too . Is there a proper way to do so?

Return the proper Result enum member, in your case Result.Failure:

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Commands_Result.htm

@nathanletwory Thanks! It works perfectly! I should check the rhinocommon API more carefully :sweat_smile:

Aye, the API documentation can be useful :wink: