Doc.NewSolution crashing Rhino

Hello,

I have ported code for my optimization plug-in from a C# component “prototype” into a “proper” component.
However, I’m now experiencing crashes when resetting the values and recomputing. The code I’m using looks like this:

slider.SetSliderValue(val);  
doc.ExpireSolution();  
doc.NewSolution(false, GH_SolutionMode.CommandLine);

Rhino crashes when I start the NewSolution, and I also don’t see the slider changing.
Any idea why that might be/possible solutions? I didn’t have this problem when running the code inside a C# component.

Thank you!
Thomas

Try

slider.SetSliderValue(val);
slider.ExpireSolution(true);

I don’t know what could be going wrong, any hope of seeing a call-stack for the crash, or an error message?

Thanks David, I tried what you suggested (and a couple of other versions), with the same result.

Here’s a stack trace I managed to get out, not sure if it’s very helpful.

Thanks,
Thomas

Do you get a Rhino crash window? If yes, did you submit the crash report? While the window is open there’s probably going to be a RhinoDotNetCrash.txt file on your desktop. This file will contain the most useful information for me.

Thanks David, I managed to solve the problem using the RhinoDotNetCrash.txt file.
For some reason, the WaitHandle I used to check if the document was solved was not referencing the Grasshopper document correctly.

http://discourse.mcneel.com/t/optimization-plug-in-for-grasshopper-how-to-use-galapagos-interface-and-gene-pool/27267/12?u=paramdessing