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

Add support for System.UIntPtr #547

Merged
merged 3 commits into from Jan 3, 2021
Merged

Add support for System.UIntPtr #547

merged 3 commits into from Jan 3, 2021

Conversation

stakx
Copy link
Member

@stakx stakx commented Jan 2, 2021

Fixes #546.

(The one longish commit message isn't strictly necessary for understanding this bugfix... in fact, it's quite unrelated. I was originally going to optimize the emitted IL a little, but decided to defer that to a later time. I'm leaving the commit message for later reference.)

@@ -72,7 +72,7 @@ private void EmitByRef(ILGenerator gen)

private bool IsPrimitiveOrClass(Type type)
{
if ((type.IsPrimitive && type != typeof(IntPtr)))
if (type.IsPrimitive && type != typeof(IntPtr) && type != typeof(UIntPtr))
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe worth noting that this double check for both IntPtr and UIntPtr is already present in other locations; it was only missing here.

DynamicProxy will now produce the same IL sequences for `UIntPtr` as it
already does for `IntPtr`:

 * For default return values:

       ldloca.s <n>
       initobj [mscorlib]System.UIntPtr
       ldloc.<n>
       ret

 * For out parameters:

       ldarg.<n>
       initobj [mscorlib]System.UIntPtr

(For comparison, the C# compiler wouldn't emit `initobj`, but instead
`ldc.i4.0` followed by `conv.i`.)
@stakx stakx added this to the v5.0.0 milestone Jan 3, 2021
@stakx stakx merged commit c2dac3f into castleproject:master Jan 3, 2021
@stakx stakx deleted the uintptr branch January 3, 2021 20:19
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.

System.UIntPtr is unsupported
1 participant