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

GraphicDataProvider Fix: Regression for pointer referencing non-clr objects #12934

Merged
merged 3 commits into from
Jun 7, 2022

Conversation

saintentropy
Copy link
Contributor

Purpose

This PR fixes a regression associated with task https://jira.autodesk.com/browse/DYN-4229 and the #11920. This adds back the check for edge cases where some Pointers are not associated with CLR Objects. That is determined by checking the associated Class within the VM ClassTable is an external library.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Release Notes

Reviewers

@sm6srw @aparajit-pratap

FYIs

@QilongTang @Amoursol

//imported library. An example is the "Function" pointer which does not have an associated CLRObject.
//In that case, the return value should be null.
var classNode = runtimeCore.DSExecutable.classTable.GetClassNodeAtIndex(svData.metaData.type);
if (classNode != null && !classNode.IsImportedClass)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is checking if it's not an imported class a sufficient condition to determine that it's a function object? My concern is that there could be (if not today) in the future, other DS types that are not treated as imported classes for which we may not want to return null.

Copy link
Contributor

@aparajit-pratap aparajit-pratap May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use this condition instead?

return IsPointer && Class.Name.Equals(CoreUtils.FunctionObjectClass) && Class.LibraryMirror.Name.Equals(CoreUtils.FunctionObjectLibrary);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on our discussion, I think it's okay to leave this as-is for now. LGTM!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may have been a pre-existing issue then. This fix just returns the function to its previous behavior.

@aparajit-pratap
Copy link
Contributor

Can we add a test case so that we don't miss a regression like this in the future?

@saintentropy
Copy link
Contributor Author

Yep let me take a look


var value = GetPreviewValue("42ac0cec-442f-4e4a-b629-1260f6db3d86");
Assert.Null(value);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seems to pass even before this fix. Can you create one that fails before this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants