Skip to content

Bugfix in Transition class with a stricter type check for boxing required types#127

Closed
victorr99 wants to merge 1 commit into
Stillpoint-Software:mainfrom
victorr99:bug/126-incorrect-value-type-assignment
Closed

Bugfix in Transition class with a stricter type check for boxing required types#127
victorr99 wants to merge 1 commit into
Stillpoint-Software:mainfrom
victorr99:bug/126-incorrect-value-type-assignment

Conversation

@victorr99
Copy link
Copy Markdown
Contributor

Description

The Transition class performs a check which tells if type A is assignable to type B. This check did not take types into account which require boxing if you want to assign them (value types like int must be boxed in order to be assignable to object).

Similar checks are done at two other places. I haven't touched these two places because I'm not sure if the fix needs to be applied there to. I guess that the FinalTransition is used when the last call in the expression is not an await call? In that case I think the current behavior is already correct (if you want to return an int from a lambda with return type object, the int must be boxed with a Convert call)

  1. if ( value != null && variable.Type.IsAssignableFrom( value.Type ) )
  2. if ( variable.Type.IsAssignableFrom( lastExpression.Type ) )

This PR fixes this issue:

Type of Change

  • Bug fix
  • New feature
  • Documentation

Checklist

  • I have run the existing tests and they pass
  • I have run the existing benchmarks and verified performance has not decreased
  • I have added new tests that prove my change is effective or that my feature works
  • I have added the necessary documentation (if applicable)

Copy link
Copy Markdown

@avarndell avarndell left a comment

Choose a reason for hiding this comment

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

Looks good

@victorr99
Copy link
Copy Markdown
Contributor Author

victorr99 commented Feb 26, 2026

Thanks for the review. Not sure if we still need to this PR because @bfarmer67 has a fix ready in #133 . As far as I know he's waiting for this issue to be addressed: dadhi/FastExpressionCompiler#495

@bfarmer67
Copy link
Copy Markdown
Contributor

Addressed in #133

@bfarmer67 bfarmer67 closed this Feb 27, 2026
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.

[BUG]: Incorrect handling of value-type to object assignment when using BlockAsync (missing boxing)

3 participants