DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.74k stars 634 forks source link

Crash report from Dynamo 2.19.3.6394 - UnwrapElement() #15569

Open Aaron12Powers opened 1 month ago

Aaron12Powers commented 1 month ago

Issue Description

Please fill in the following information to help us reproduce the issue: Revit/Dynamo Fully crashing (Without crash window or any form of warning) when passing custom class instances into "UnwrapElement()" within a Python Script Node running the CPython3 engine

For years, Ive handled Python Node Inputs by running everything through a "UnwrapElement()" method as a sort of catch all (probably not the best practice admittedly). This never caused issues and I've assumed it functioned as a passthrough if the arguments were not Revit Elements. This includes, lists, dictionaries, and custom class instances which may contain elements as member properties within them.

The Custom Classes is where I believe things have changed. Whenever I pass in an instance of a custom class dynamo spins for ~10 seconds then completely closes everything associated to the Revit Window.

Dynamo version

Dynamo: 2.19.3.6394

Operating system

OS: Microsoft Windows NT 10.0.19045.0

What did you do?

I passed a custom class instance containing a Revit Element as one of it's properties into the "UnwrapElement()" method

I was able to replicate this very simply with the following code: ` class TestObj: def init(self): self.Name = "Test"

UnwrapElement(TestObj()) `

What did you expect to see?

I expected UnwrapElement to either return the same instance I passed into it with no change, or to throw an argument error from the python node if the argument types have been restricted.

What did you see instead?

Full Revit/Dynamo Crash without error message/window.

What packages or external references (if any) were used?

Python Script Node - CPython3

Stack Trace

No Crash Window was Produced


CLR: 4.0.30319.42000

avidit commented 3 weeks ago

tracked internally https://jira.autodesk.com/browse/DYN-7785

twastvedt commented 2 weeks ago

Hi @Aaron12Powers ! Is unwrapping custom classes something that has worked for you in the past? A different version of Dynamo, or was it in IronPython, same version?

Aaron12Powers commented 2 weeks ago

Hey @twastvedt, I've unwrapped custom classes here and there in the past. I'm not certain that it has ever actually performed the "Unwrap" on the custom class, say if the instance has a list of wrapped elements stored as a member I'm not sure it actually unwraps the elements in that list or anything but it never caused crashing.

These are my results of some limited testing Code Ran:

class TestObj:
    def init(self):
        self.Name = "Test"

UnwrapElement(TestObj())

Revit 2022 - First year CPython3 was included Dynamo Core 2.12.1.8246 Dynamo Revit 2.12.1.111.23 IronPython2 - Ran without error CPython3 - Ran without error

Revit 2024 - Version I typically use day to day Dynamo Core 2.19.3.6394 Dynamo Revit 2.19.4.13096 IronPython2 - Ran without error CPython3 - Crashed Revit+Dynamo without error message

twastvedt commented 2 weeks ago

Thanks for the detail! Yep, I can reproduce that. We'll add it to the list!