From e45bce1a64bd30c462abf51ab3b4eec69d5346aa Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Mon, 12 Dec 2016 21:03:30 +0100 Subject: [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. --- Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml | 7 ++++ .../Issues/Bz49307.xaml.cs | 47 ++++++++++++++++++++++ .../Xamarin.Forms.Xaml.UnitTests.csproj | 6 +++ 3 files changed, 60 insertions(+) create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml create mode 100644 Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml.cs (limited to 'Xamarin.Forms.Xaml.UnitTests') diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml new file mode 100644 index 00000000..3bb6e203 --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml @@ -0,0 +1,7 @@ + + + + + #c2d1d3 + + diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml.cs new file mode 100644 index 00000000..166706af --- /dev/null +++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz49307.xaml.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using Xamarin.Forms; +using Xamarin.Forms.Core.UnitTests; + +namespace Xamarin.Forms.Xaml.UnitTests +{ + public partial class Bz49307 : Application + { + public Bz49307() + { + InitializeComponent(); + } + + public Bz49307(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Tests + { + [SetUp] + public void Setup() + { + Device.PlatformServices = new MockPlatformServices(); + } + + [TearDown] + public void TearDown() + { + Device.PlatformServices = null; + } + + [TestCase(true)] + [TestCase(false)] + public void ThrowOnMissingDictionary(bool useCompiledXaml) + { + if (useCompiledXaml) + Assert.Throws(() => new Bz49307(useCompiledXaml)); + else + Assert.Throws(new XamlParseExceptionConstraint(5, 4), () => new Bz49307(useCompiledXaml)); + } + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj index 2234c7f9..4f14fd36 100644 --- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj +++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj @@ -403,6 +403,9 @@ I8.xaml + + Bz49307.xaml + @@ -727,6 +730,9 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + -- cgit v1.2.3