Skip to content

Serialiser_Engine: Stop throwing error on System.DBNull #3276

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

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

Tom-Kingstone
Copy link
Contributor

NOTE: Depends on

Issues addressed by this PR

Closes #3210

after many hours of searching, finally found out that System.DBNull should serialise as null, so we should stop throwing errors when trying to serialise it.

Test files

3210-DBNullCannotBeSerialised.zip
Run through instructions made by myself in parent issue.

Changelog

Additional comments

@Tom-Kingstone Tom-Kingstone added the type:bug Error or unexpected behaviour label Feb 2, 2024
@Tom-Kingstone Tom-Kingstone self-assigned this Feb 2, 2024
Copy link
Contributor

@albinber albinber left a comment

Choose a reason for hiding this comment

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

No longer running into the error when testing, nice work @Tom-Kingstone!

@albinber
Copy link
Contributor

albinber commented Feb 2, 2024

@BHoMBot check compliance
@BHoMBot check versioning

Copy link

bhombot-ci bot commented Feb 2, 2024

@albinber to confirm, the following actions are now queued:

  • check code-compliance
  • check documentation-compliance
  • check project-compliance
  • check branch-compliance
  • check dataset-compliance
  • check copyright-compliance
  • check versioning

@Tom-Kingstone
Copy link
Contributor Author

@BHoMBot check core
@BHoMBot check installer

Copy link

bhombot-ci bot commented Feb 2, 2024

@Tom-Kingstone to confirm, the following actions are now queued:

  • check core
  • check installer

There are 24 requests in the queue ahead of you.

Copy link
Contributor

@FraserGreenroyd FraserGreenroyd left a comment

Choose a reason for hiding this comment

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

Thanks @Tom-Kingstone and @albinber

To recap some of the work from todays workshop on this, the 'issue' is caused by components in the UI utilising the System.DBNull type for default values as opposed to traditional null. When components are added or deleted, the Grasshopper write method is called to serialise the component in the state it was in, which then causes this issue where our serialiser encounters a System.DBNull and throws an error when it can't serialise it.

This only then caused a problem on the canvas when a larger component, handling a lot of data, intercepts the error recorded and assigns it to that component, rather than the component (deletion) which triggered it. This then gives a confusing and poor UX.

This PR resolves that poor UX by treating items of type System.DBNull as the same as null for serialisation purposes, which I think makes the most logical sense for the time being.

I've run through a few tests on this and it all looks ok from what I can see, so I'm going to merge this for now so that if there are any issues, others can help us spot them via alphas.

Cheers again both 😄

@FraserGreenroyd
Copy link
Contributor

@BHoMBot check serialisation
@BHoMBot check null-handling
@BHoMBot check ready-to-merge

Copy link

bhombot-ci bot commented Feb 2, 2024

@FraserGreenroyd to confirm, the following actions are now queued:

  • check serialisation
  • check null-handling
  • check ready-to-merge

There are 3 requests in the queue ahead of you.

@FraserGreenroyd
Copy link
Contributor

@BHoMBot this is a DevOps instruction. I am requesting neutral checks on: unit-tests

Copy link

bhombot-ci bot commented Feb 2, 2024

@FraserGreenroyd I have provided neutral checks to the checks requested. These checks will need to be run properly to obtain full results.

@FraserGreenroyd FraserGreenroyd merged commit 88112c5 into develop Feb 2, 2024
@FraserGreenroyd FraserGreenroyd deleted the Serialiser_Engine-#3210-SystemDBNullFix branch February 2, 2024 18:39
@bhombot-ci bhombot-ci bot mentioned this pull request Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialiser_Engine: Object of type System.DBNull cannot be serialised.
3 participants