Rhino crashing when I set shaded view

Hi all,

I am facing a strange problem. When I draw something with my plugin and I try to turn the view from wireframe to shaded view from the GUI Rhino crashes. I thought I had solved the problem using the Redraw() function but the problem comes out again. Do you have any idea of what can cause this crash?


If you write your plug-in with C++ or C# (or other .NET language) in Visual Studio you should debug with VS.debugger. You should get an exception and callstack that give you an idea what goes on.

Without that information one can only guess.

1 Like

I had a similar issue, but i was using unsafe code to manipulate mesh math,(the holy grail of trying to write a c# equivalent of find mesh edges, and retopologise), rewriting the mesh and passing an “impossible” mesh back to rhino, all worked fine in theory until I tried to display it, spectacular crashes though! 10/10 for creative ways to kill rhino. Tried to screenrecord but I even manage to BSOD win10 with it :wink:

@jesterking. The problem is that this happens when I change the setting from the GUI (sorry I forgot to mention it)… I am just wondering if someone had the same problem. A guess could be useful anyway

@ChristopherBotha strange, because I don’t think I have done anything so fancy… (even if the plugin is pretty big)

How are you developing your plug-in? C#, C++ or something else? With Visual Studio 2017?

If you build a debug version of your plug-in you should start Rhino through the debug configuration. If you used RhinoCommon (C# etc) you should change the exception settings after starting to breal on any CLR exception, then cause the crash. Same really for C++, except change to break on any C/C++ exception.

My best guess is that you did something wrong.

Above will pinpoint where exactly things go wrong, which in turn will tell you hopefully why.

You might find a file with the name RhinoCrashDump.dmp on your desktop. Zip it up and upload it with a reply, maybe some kind soul can have a look - or open the file in VS and see for yourself.

Btw, you also may want to ensure you are on the latest SR (6.6). Bugs get fixed all the time in Rhino.

Hi @gennaro,

If you can repeat this, we’d love to see some sample source code that we could use to repeat it here.

– Dale

Hi Dale!

unfortunately I have a really big plugin. I have tried to reproduce the problem in a small script but I did not manage to isolate the problem. However I have found this workaround to solve the problem. I simply create a brep at the start of my plugin and I draw it in this way:
::RhinoApp().ActiveView()->Viewport().DisplayPipeline()->DrawShadedBrep(brepInit, NULL, NULL);
This idea came in my mind because I noticed before that the problem did not show up if I drew something before from the GUI.
I am wondering if in some way the DisplayPipeline is not initialized in my plugin for some reason.
Does it ring a bell to you?

@jesterking thanks for the advice!! I use C++ so I could do it but unfortunately I need to build in Release because of many dependencies…

UPDATE: it seems that also the crash happens if the object is outside the bounding box of the brep I created and drew in the displaypipeline. Furthermore I have to do also DrawRenderedMesh otherwise Rhino crashes when I set the rendered view

Hi @gennaro,

Are you submitting your crash dumps?

This code makes me cringe. Please modify to look more like this:

CRhinoView* pView = RhinoApp().ActiveView();
if (nullptr != pView)
  CRhinoDisplayPipeline* pDisplayPipline = pView->ActiveViewport().DisplayPipeline();
  if (nullptr != pDisplayPipline)
    pDisplayPipline->DrawShadedBrep(brep, nullptr, nullptr);

– Dale


I did submit it. Should I write a specific message for you in the crash dump?

Thanks for the code, it is probably safer and I will use it. However I replace all the previous DrawShadedBrep calls and the problem is still there. I have been struggling and I have found out that I could temporarily fix it calling DrawShadedBrep and DrawRenderedMesh in a specific place of my code… I am really buffled…

Hi @gennaro,

If the crash is occurring in your code, it is best that you evaluate the dump file (rather than us).

And again, without a sample that we can use to repeat the crash, there isn’t a whole lot we can do…

– Dale