From f5093e21b85f5908cdc0b9752d959d9087798102 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 15 Sep 2019 15:15:45 +0200 Subject: [PATCH] Fixed unboxing for value types --- .../Translation/Models/ReadableMember.GetValue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs index e30bb2be..71306ce6 100644 --- a/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs +++ b/src/ComputeSharp.Shaders/Translation/Models/ReadableMember.GetValue.cs @@ -47,7 +47,7 @@ namespace ComputeSharp.Shaders.Translation.Models // Load the argument (the object instance) and cast it to the right type il.Emit(OpCodes.Ldarg_0); - il.Emit(OpCodes.Castclass, DeclaringType); + il.Emit(DeclaringType.IsValueType ? OpCodes.Unbox : OpCodes.Castclass, DeclaringType); // Get the member value with the appropriate method if (Property != null) il.EmitCall(OpCodes.Callvirt, Property.GetMethod, null);