mcneel / rhinocommon

RhinoCommon is the .NET SDK for Rhino5 / Grasshopper
http://wiki.mcneel.com/developer/rhinocommon
244 stars 93 forks source link

AccessViolationException in Brep.CreatePlanarBreps invoked via PLINQ #167

Closed rosecodym closed 9 years ago

rosecodym commented 9 years ago

I posted a thread to the forums a few months back regarding an AccessViolationException I was intermittently getting during a call to Brep.CreatePlanarBreps: http://discourse.mcneel.com/t/accessviolationexception-in-brep-createplanarbreps/18338/9

I'm submitting an issue here because I've had some time to investigate, and I've been able to create a consistent reproduction case. The cause is not, as was suggested in that thread, lazily-evaluated LINQ queries, but has something to do with PLINQ execution of geometry operations.

The objects in question are not document-controlled. It was my understanding that RhinoCommon geometry operations are supposed to be thread-safe in this case, but that appears to not hold here.

The reproduction is available here: https://www.dropbox.com/s/3h8881bs1jj1xjx/AccessViolationException.zip?dl=0 It includes a Rhino document and a plugin with a single command "ReproduceError" that will reproduce the error (causing a Rhino crash if no debugger is attached) when run when the provided document is open. (The plugin is supplied in both source and binary form.) This has been tested against the RhinoCommon shipped with SR11 (64-bit), on Windows 7.

sbaer commented 9 years ago

Moved to youtrack http://mcneel.myjetbrains.com/youtrack/issue/RH-31012