summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Build.Tasks
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-12-12 20:03:30 (GMT)
committerGitHub <noreply@github.com>2016-12-12 20:03:30 (GMT)
commite45bce1a64bd30c462abf51ab3b4eec69d5346aa (patch)
tree1f0169edfc221b241f92d1588221fd9fcaa009ad /Xamarin.Forms.Build.Tasks
parent8257753d1b48de0e81d5bd431604f60d2065b6cc (diff)
downloadxamarin-forms-e45bce1a64bd30c462abf51ab3b4eec69d5346aa.zip
xamarin-forms-e45bce1a64bd30c462abf51ab3b4eec69d5346aa.tar.gz
xamarin-forms-e45bce1a64bd30c462abf51ab3b4eec69d5346aa.tar.bz2
[XamlC] Box valueTypes on Add() (#624)
This doesn't happen often, and I haven't found any valid XAML file out there requiring this, but in the case of 49307, it at least generates valid IL, which then fails with a NRE as this is the nature of callvirt.
Diffstat (limited to 'Xamarin.Forms.Build.Tasks')
-rw-r--r--Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs2
1 files changed, 2 insertions, 0 deletions
diff --git a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
index 67c345f..6a7a3be 100644
--- a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
+++ b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
@@ -1034,6 +1034,8 @@ namespace Xamarin.Forms.Build.Tasks
yield return Instruction.Create(OpCodes.Ldloc, vardef);
if (implicitOperator != null)
yield return Instruction.Create(OpCodes.Call, module.Import(implicitOperator));
+ if (implicitOperator == null && vardef.VariableType.IsValueType && !childType.IsValueType)
+ yield return Instruction.Create(OpCodes.Box, vardef.VariableType);
yield return Instruction.Create(OpCodes.Callvirt, adderRef);
if (adderRef.ReturnType.FullName != "System.Void")
yield return Instruction.Create(OpCodes.Pop);