SDK change - linetype table access?

I have some code in a GH plugin that works fine in Rhino 5 - it accesses the RhinoDoc.ActiveDoc.LinetypeTable at a particular index. When I run it in the WIP, it works fine initially, but after having opened a new document, the same code throws a ‘Rhino.Runtime.DocumentCollectedException’. I had a similar error previously when I was holding on to a reference to a document that had since closed - but in this case I am re-accessing the ActiveDoc immediately as I am making this call, so I’m not sure what’s wrong. Is there something different I need to do?

incidentally, the error seems only to occur when I access the linetypetable at index [-1] (which typically yields “Continuous”)

what’s more, the error doesn’t get thrown until I actually try to retrieve a property of that Linetype ( .Name, for instance)

bump - anybody?

@piac can you take a look at this? It sounds like there may be a bug related to recent changes in the table access in RhinoCommon.

Hi Andrew @andheum

we had to change quite deeply how this data type is handled in Rhino WIP. I’ll try to reproduce, but otherwise, (if you happen to have it), do you have a sample I can look at?

@piac:
example.gh (2.2 KB)

dead simple GH example - just a C# one-liner:

A = RhinoDocument.Linetypes[-1].Name;

Runs great in a fresh rhino doc - if you create a new rhino doc it fails.

I logged this at http://mcneel.myjetbrains.com/youtrack/issue/RH-35350.
I think this will be tackled soon.

Hi @andheum

this should be fixed in current code. The next release will contain the fix. It will go out likely next Tuesday.

Thanks!

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com