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

StackItem.GetHashCode probably shouldn't throw any Exception. #3544

Open
nan01ab opened this issue Oct 23, 2024 · 1 comment · May be fixed by #3549
Open

StackItem.GetHashCode probably shouldn't throw any Exception. #3544

nan01ab opened this issue Oct 23, 2024 · 1 comment · May be fixed by #3549
Assignees
Labels
discussion Initial issue state - proposed but not yet accepted
Milestone

Comments

@nan01ab
Copy link
Contributor

nan01ab commented Oct 23, 2024

According to the C# Specification, GetHashCode() must have some properties, for example:

The GetHashCode() method should not throw exceptions.

So, StackItem.GetHasoCode probably shouldn't throw any Exception.

But in current implementation, StackItem may throw exceptions in some cases:

  • CompoundType.GetHashCode throws NotSupportedException directly;
  • The default implementation of StackItem.GetHashCode is to compute the HashCode of GetSpan, but GetSpan throw an InvalidCastException in default.

Where in the software does this update applies to?

  • VM
@nan01ab nan01ab added the discussion Initial issue state - proposed but not yet accepted label Oct 23, 2024
@shargon shargon changed the title StackItem.GetHasoCode probably shouldn't throw any Exception. StackItem.GetHashCode probably shouldn't throw any Exception. Oct 23, 2024
@cschuchardt88
Copy link
Member

cschuchardt88 commented Oct 23, 2024

Fixed in #3549

cschuchardt88 added a commit to cschuchardt88/neo that referenced this issue Oct 23, 2024
@cschuchardt88 cschuchardt88 linked a pull request Oct 23, 2024 that will close this issue
15 tasks
@cschuchardt88 cschuchardt88 self-assigned this Oct 23, 2024
@cschuchardt88 cschuchardt88 added this to the v3.8.0 milestone Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Initial issue state - proposed but not yet accepted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants