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

Support void* to UIntPtr parameter conversion for Invoked method #73748

Merged
merged 7 commits into from
Aug 12, 2022

Conversation

buyaa-n
Copy link
Contributor

@buyaa-n buyaa-n commented Aug 11, 2022

There automatic type conversion takes place from Pointer (*) types to IntPtr but not for UIntPtr (throws NotSupportedException). Whenever possible it should be able to convert to UintPtr too

Fixes #7430

@ghost
Copy link

ghost commented Aug 11, 2022

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

There automatic type conversion takes place from Pointer (*) types to IntPtr but not for UIntPtr (throws NotSupportedException). Whenever possible it should be able to convert to UintPtr too

Fixes #7430

Author: buyaa-n
Assignees: -
Labels:

area-System.Reflection

Milestone: -

@jkotas
Copy link
Member

jkotas commented Aug 11, 2022

Also, add the handling of this case to ConvertPointerIfPossible to src\coreclr\nativeaot\System.Private.CoreLib\src\System\InvokeUtils.cs for NativeAOT. We do not have this code unified yet.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM modulo feedback

@buyaa-n buyaa-n removed the request for review from AaronAstle August 11, 2022 21:20
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@buyaa-n
Copy link
Contributor Author

buyaa-n commented Aug 12, 2022

Test failures unrelated and filed issues for not reported ones #73874, #73872

@buyaa-n buyaa-n merged commit cb2dfad into dotnet:main Aug 12, 2022
@buyaa-n buyaa-n deleted the uintptr-fix branch August 12, 2022 23:07
@ghost ghost locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type validation holes when using Reflection to invoke a method with a void* parameter.
4 participants