-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
Multi Cast Delegate with Struct types cause CLR_E_WRONG_TYPE exception #1829
Conversation
@AdrianSoundy there are issues with the code style on the source files. Make sure you are using the project code style. Check the details here. |
Automated fixes for code style.
@AdrianSoundy there are issues with the code style on the source files. Make sure you are using the project code style. Check the details here. |
Tests for all types and arrays. Maybe be useful to update to test with generics |
…c-ef7f-4cb0-b460-2b4c1f0bbb49' into MultiCast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test for the heapblock containing a boxed value seems to be all it takes to properly deal with this. Well done! 💯 👍🏻
Description
MultiCast delegate for Structure value types( structs, DateTime, TimeSpan) causes a CLR_E_WRONG_TYPE error. Other types work ok. This looks like an edge case inherited from .NetMF.
Single Cast delegates work differently and don't have a problem.
This is due to the code trying to Unbox the valueType argument in CLR_RT_StackFrame::FixCall, but its doesn't need unboxing as its a structure type. The PerformUnboxing causes the error because it tests for valuetype to be boxed.
Adding an extra test for IsBoxed resolves issue.
Spent some time doing a delegate test program with various types , single and multi cast. Included test project with this PR
Motivation and Context
How Has This Been Tested?
Delegate test program (included)
Screenshots
Types of changes
Checklist: