Skip to content

Add support for System.UIntPtr#547

Merged
stakx merged 3 commits intocastleproject:masterfrom
stakx:uintptr
Jan 3, 2021
Merged

Add support for System.UIntPtr#547
stakx merged 3 commits intocastleproject:masterfrom
stakx:uintptr

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.)

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.

stakx added 3 commits January 3, 2021 21:01
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