Human RenderToScreen Components Causing Rhino Crash

Hi All,
I am working on displaying Data on Rhino Screen while working on Specific script and the RenderToScreen Components to Preview information. But It is Causing Rhino to Crash frequently.

I haven’t come across any crashing behavior previously with these components… can you share a definition where this behavior is happening? which version of Rhino are you using?

Hi andrew,
Please find the Script here.Check File.gh (149.5 KB)
I am using Rhino6 SR7

As the Script is running and you rotate the View in viewport, it Will crash while refreshing the Preview.

Hi Andrew, Any update?

this looks like a rhino bug. Internally, the crash occurs when I’m creating a TextEntity object with these lines:

 TextEntity entity = new TextEntity
                  {
                      PlainText = text,
                      Plane = plane,
                      TextHeight = size
                  };

The internal error is this: + $exception {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."} System.AccessViolationException StackTrace " at UnsafeNativeMethods.ON_V6_Annotation_SetTextString(IntPtr annotation, String str, IntPtr constDimstyle) at Rhino.Geometry.AnnotationBase.set_PlainText(String value) at Human.TextToScreen.DrawViewportWires(IGH_PreviewArgs args) at Grasshopper.Kernel.GH_Document.PreviewPostDrawObjects(Object sender, DrawEventArgs e) at System.EventHandler1.Invoke(Object sender, TEventArgs e) at Rhino.Display.DisplayPipeline.OnPostDrawObjects(IntPtr pPipeline, IntPtr pConduit)" string

Hi @andheum,

This seems to work from a test command:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var text = "Andrew Heumann";
  var plane = Plane.WorldXY;
  var size = 10;

  TextEntity entity = new TextEntity
  {
    PlainText = text,
    Plane = plane,
    TextHeight = size
  };

  // TODO...

Is there a way I can repeat what you are seeing?

– Dale

@dale - I can reproduce it consistently from within grasshopper by calling this code repeatedly in quick succession - see the attached grasshopper definition above - just orbit the viewport back and forth and you should see a crash. I also reported this here: New TextEntity crash

Lemme see if I can code up a minimal c# script in GH that reproduces the problem.

well, wouldn’t you know it… the problem seems to have gone away as of Version 6 SR11 - even with the .gh file above I can’t get the crash to occur.

1 Like

This does sound related to something I fixed in recent months.

1 Like