I have written a plugin in VB.Net that takes quite a long time to execute (30 seconds maybe). While the plugin is executing the window is periodically updated and I’m writing status information. This is so the user has some feedback and is able to see that all is working correctly.
Everything works great if I debug the plugin from VS. If I run the plugin while VS is not debugging Rhino is not responding after a few seconds. While Rhino is frozen the plugin continues its work in the background. Once the plugin is finished Rhino unfreezes and all the windows are updated correctly. From the user point of view it looks like my plugin is crashing Rhino and then Rhino sorts itself out and everything is ok. How do I stop Rhino from freezing while not debugging?
When you are running a long, time-consuming calculation, you are (basically) hogging CPU cycles. Because of this, Rhino does not have a chance to check it’s (Windows) message queue. This, Rhino’s UI can appear to freeze.
To keep Rhino’s UI alive, you need to give Rhino an opportunity to check and process its Windows messages. You can do this by calling RhinoApp.Wait() periodically inside of your long, time-consuming calculation.