Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement suggestion: 2D lists with empty sublists triggers "Dereferencing a non-pointer" exception #8411

Closed
ThomasMahon opened this issue Dec 21, 2017 · 10 comments
Labels
bug engine Issues related to the engine driving Dynamo. tracked

Comments

@ThomasMahon
Copy link

ThomasMahon commented Dec 21, 2017

Dynamo version

1.3.2

Operating system

Win 10

Improvement Suggestion

I found that any 'property' node will throw an exception if a 2D list is input where the sublists contain both objects and sublists that are empty. The solution is to remove the empty sublists or flatten the list, but its not immediately obvious to users and could easily be bypassed with a better implementation in Dynamos VM.

For example, BimorphNodes Element.IntersectsElement, or Element.IntersectsSolid output lists of this strucutre to enable the user to understand if there are any clashes. If no clashes are found, empty sublists are returned to indicate 'no clashes'. If clashes are found, the sublists are populated with the clashing elements. Maintaining the data structure is very important to enable the user to ascertain where the clashes are located, so avoiding this problem via the node itself is not an option. If the output is connected to, say, Element.Solids node, the exception is thrown. If the list is flattened or the empty sublists removed, no exception is thrown and the expected behaviour is observed (nulls where the sublists are empty).

Can this behaviour be improved as it inhibits usability and creates an unnecessary abstraction to users (this issues is not specific to BimorphNodes for the record)?

I should add, creating methods which return the desired members (say, solids) is one solution, however this then screws up the library structure and 'shifts' the problem.

@aparajit-pratap
Copy link
Contributor

@ThomasMahon is this exception thrown with a particular node or most nodes in general? Could you share a simple graph to demonstrate the workflow? Thanks!

@ThomasMahon
Copy link
Author

ThomasMahon commented Jan 3, 2018

@aparajit-pratap its any property node from any library.

Here are some examples, example graph attached. It seems to be null that causes the exception as I've input null to the list as a test and also flattened and still see the problem. I read on MSDN that if exceptions are expected with properties, make them methods instead, but that is clearly impractical:

Example Dereferencing a non-pointer.zip

Autodesk.DesignScript.Geometry
image

image

Revit.Elements
image

BimorphNodes
image

@ThomasMahon
Copy link
Author

ThomasMahon commented Jan 3, 2018

@aparajit-pratap also, look what happens if the first item contains an object that isn't null or an empty list, oddly, it works as expected. So it seems if the first object is null, the property fails:

image

image

image

@andydandy74
Copy link
Contributor

Looks similar to #5238

@aparajit-pratap
Copy link
Contributor

Thanks @ThomasMahon. This issue was partly addressed for methods here but unfortunately still persists for properties. We'll make a note of it but cannot promise a fix for 2.0.

@aparajit-pratap
Copy link
Contributor

@ThomasMahon
Copy link
Author

@aparajit-pratap thanks for the update. Any chance in the meantime you could update the exception message to provide the user with more instructions on how to resolve?

@johnpierson johnpierson added tracked engine Issues related to the engine driving Dynamo. and removed DesignScript labels Nov 8, 2018
@reddyashish
Copy link
Contributor

This is being fixed in 2.2 release.

@QilongTang
Copy link
Contributor

@reddyashish Can you point to the PR and close this?

@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Apr 18, 2019

Fixed in #9559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug engine Issues related to the engine driving Dynamo. tracked
Projects
None yet
Development

No branches or pull requests

6 participants