From 740b9038f5f70a716f0ff559674552efe6e87573 Mon Sep 17 00:00:00 2001 From: Samantha Houts Date: Thu, 7 Mar 2019 14:44:10 -0800 Subject: [PATCH 01/25] [Maps} move design dll to the design folder (#5481) - fixes #5472 --- .nuspec/Xamarin.Forms.Maps.nuspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.nuspec/Xamarin.Forms.Maps.nuspec b/.nuspec/Xamarin.Forms.Maps.nuspec index 06fb167df9b..183bd665fb6 100644 --- a/.nuspec/Xamarin.Forms.Maps.nuspec +++ b/.nuspec/Xamarin.Forms.Maps.nuspec @@ -65,8 +65,8 @@ - - + + From b5c8345fa80bcfa50401d97085d76b3e1c168808 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 11 Mar 2019 17:52:36 +0900 Subject: [PATCH 02/25] [XamlC] Fix message for unresolved event handler reference in DataTemplate (#5502) --- Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs index c02070bfcff..f704bf0bd20 100644 --- a/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs +++ b/Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs @@ -933,7 +933,7 @@ static IEnumerable ConnectEvent(VariableDefinition parent, string l declaringType = declaringType.DeclaringType; var handler = declaringType.AllMethods().FirstOrDefault(md => md.Name == value as string); if (handler == null) - throw new XamlParseException($"EventHandler \"{value}\" not found in type \"{context.Body.Method.DeclaringType.FullName}\"", iXmlLineInfo); + throw new XamlParseException($"EventHandler \"{value}\" not found in type \"{declaringType}\"", iXmlLineInfo); //check if the handler signature matches the Invoke signature; var invoke = module.ImportReference(eventinfo.EventType.ResolveCached().GetMethods().First(md => md.Name == "Invoke")); From 9af95f0399e34f4dac40a64d102ec43bfe67831b Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Mon, 11 Mar 2019 14:38:34 +0100 Subject: [PATCH 03/25] [X] recover from missing markup type (#5485) - fixes #5484 --- .../DesignTimeLoaderTests.cs | 8 +++-- Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs | 14 ++++++--- Xamarin.Forms.Xaml/XamlServiceProvider.cs | 30 ++++++------------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Xamarin.Forms.Xaml.UnitTests/DesignTimeLoaderTests.cs b/Xamarin.Forms.Xaml.UnitTests/DesignTimeLoaderTests.cs index 4b1d76b9e1c..d450bc5a85c 100644 --- a/Xamarin.Forms.Xaml.UnitTests/DesignTimeLoaderTests.cs +++ b/Xamarin.Forms.Xaml.UnitTests/DesignTimeLoaderTests.cs @@ -559,8 +559,12 @@ public void IgnoreMarkupExtensionException() { var xaml = @" - + xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"" + xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests""> + + + + "; var exceptions = new List(); diff --git a/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs b/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs index 104657e27c9..0296222f341 100644 --- a/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs +++ b/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs @@ -92,13 +92,13 @@ INode ParseExpression(ref string expression, IXmlNamespaceResolver nsResolver, I var serviceProvider = new XamlServiceProvider(node, Context); serviceProvider.Add(typeof (IXmlNamespaceResolver), nsResolver); - return new MarkupExpansionParser().Parse(match, ref expression, serviceProvider); + return new MarkupExpansionParser { ExceptionHandler = Context.ExceptionHandler}.Parse(match, ref expression, serviceProvider); } public class MarkupExpansionParser : MarkupExpressionParser, IExpressionParser { IElementNode node; - + internal Action ExceptionHandler { get; set; } object IExpressionParser.Parse(string match, ref string remaining, IServiceProvider serviceProvider) { return Parse(match, ref remaining, serviceProvider); @@ -137,8 +137,14 @@ public INode Parse(string match, ref string remaining, IServiceProvider serviceP else { //The order of lookup is to look for the Extension-suffixed class name first and then look for the class name without the Extension suffix. - if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type)) - throw new XamlParseException($"MarkupExtension not found for {match}", serviceProvider); + if (!typeResolver.TryResolve(match + "Extension", out type) && !typeResolver.TryResolve(match, out type)) { + var ex = new XamlParseException($"MarkupExtension not found for {match}", serviceProvider); + if (ExceptionHandler != null) { + ExceptionHandler(ex); + return null; + } + throw ex; + } } var namespaceuri = nsResolver.LookupNamespace(prefix) ?? ""; diff --git a/Xamarin.Forms.Xaml/XamlServiceProvider.cs b/Xamarin.Forms.Xaml/XamlServiceProvider.cs index 127d76d7fd2..2992d2a98af 100644 --- a/Xamarin.Forms.Xaml/XamlServiceProvider.cs +++ b/Xamarin.Forms.Xaml/XamlServiceProvider.cs @@ -201,19 +201,13 @@ internal XamlTypeResolver(IXmlNamespaceResolver namespaceResolver, GetTypeFromXm Assembly currentAssembly) { this.currentAssembly = currentAssembly; - if (namespaceResolver == null) - throw new ArgumentNullException(); - if (getTypeFromXmlName == null) - throw new ArgumentNullException(); - - this.namespaceResolver = namespaceResolver; - this.getTypeFromXmlName = getTypeFromXmlName; + this.namespaceResolver = namespaceResolver ?? throw new ArgumentNullException(); + this.getTypeFromXmlName = getTypeFromXmlName ?? throw new ArgumentNullException(); } Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider serviceProvider) { - XamlParseException e; - var type = Resolve(qualifiedTypeName, serviceProvider, out e); + var type = Resolve(qualifiedTypeName, serviceProvider, out XamlParseException e); if (e != null) throw e; return type; @@ -221,8 +215,7 @@ Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider servic bool IXamlTypeResolver.TryResolve(string qualifiedTypeName, out Type type) { - XamlParseException exception; - type = Resolve(qualifiedTypeName, null, out exception); + type = Resolve(qualifiedTypeName, null, out XamlParseException exception); return exception == null; } @@ -234,28 +227,23 @@ Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider, out Xam return null; string prefix, name; - if (split.Length == 2) - { + if (split.Length == 2) { prefix = split[0]; name = split[1]; } - else - { + else { prefix = ""; name = split[0]; } IXmlLineInfo xmlLineInfo = null; - if (serviceProvider != null) - { - var lineInfoProvider = serviceProvider.GetService(typeof (IXmlLineInfoProvider)) as IXmlLineInfoProvider; - if (lineInfoProvider != null) + if (serviceProvider != null) { + if (serviceProvider.GetService(typeof(IXmlLineInfoProvider)) is IXmlLineInfoProvider lineInfoProvider) xmlLineInfo = lineInfoProvider.XmlLineInfo; } var namespaceuri = namespaceResolver.LookupNamespace(prefix); - if (namespaceuri == null) - { + if (namespaceuri == null) { exception = new XamlParseException(string.Format("No xmlns declaration for prefix \"{0}\"", prefix), xmlLineInfo); return null; } From 9146b1d986511556d1b454830ec7b6c926467750 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Mon, 11 Mar 2019 14:45:38 -0600 Subject: [PATCH 04/25] Fix up Sandbox to work with previewer and add android material reference in (#5513) * fix sandbox to work with previewer * small page fixes --- Xamarin.Forms.Sandbox.Android/MainActivity.cs | 5 +++-- .../Xamarin.Forms.Sandbox.Android.csproj | 4 ++++ .../Xamarin.Forms.Sandbox.iOS.csproj | 4 ++++ Xamarin.Forms.Sandbox/App.StartHere.cs | 7 ++----- Xamarin.Forms.Sandbox/MainPage.xaml | 6 ++++-- Xamarin.Forms.Sandbox/Xamarin.Forms.Sandbox.csproj | 8 ++------ 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Xamarin.Forms.Sandbox.Android/MainActivity.cs b/Xamarin.Forms.Sandbox.Android/MainActivity.cs index bd16617e3cb..1f7693aadc5 100644 --- a/Xamarin.Forms.Sandbox.Android/MainActivity.cs +++ b/Xamarin.Forms.Sandbox.Android/MainActivity.cs @@ -18,8 +18,9 @@ protected override void OnCreate(Bundle savedInstanceState) ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); - global::Xamarin.Forms.Forms.Init(this, savedInstanceState); - LoadApplication(new App()); + global::Xamarin.Forms.Forms.Init(this, savedInstanceState); + global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState); + LoadApplication(new App()); } } } \ No newline at end of file diff --git a/Xamarin.Forms.Sandbox.Android/Xamarin.Forms.Sandbox.Android.csproj b/Xamarin.Forms.Sandbox.Android/Xamarin.Forms.Sandbox.Android.csproj index 861c5f2b26b..73262d13fb7 100644 --- a/Xamarin.Forms.Sandbox.Android/Xamarin.Forms.Sandbox.Android.csproj +++ b/Xamarin.Forms.Sandbox.Android/Xamarin.Forms.Sandbox.Android.csproj @@ -101,6 +101,10 @@ {6e53feb1-1100-46ae-8013-17bba35cc197} Xamarin.Forms.Platform.Android (Forwarders) + + {e1586ce6-8eac-4388-a15a-1aabf108b5f8} + Xamarin.Forms.Material.Android + {3b72465b-acae-43ae-9327-10f372fe5f80} Xamarin.Forms.Platform.Android.FormsViewGroup diff --git a/Xamarin.Forms.Sandbox.iOS/Xamarin.Forms.Sandbox.iOS.csproj b/Xamarin.Forms.Sandbox.iOS/Xamarin.Forms.Sandbox.iOS.csproj index 61ffdda2d5f..3d4d6fb0e0f 100644 --- a/Xamarin.Forms.Sandbox.iOS/Xamarin.Forms.Sandbox.iOS.csproj +++ b/Xamarin.Forms.Sandbox.iOS/Xamarin.Forms.Sandbox.iOS.csproj @@ -184,6 +184,10 @@ {e155c410-e5de-464d-9ed7-2b1e672438ed} Xamarin.Forms.Sandbox + + {9db2f292-8034-4e06-89ad-98bbda4306b9} + Xamarin.Forms.Xaml + diff --git a/Xamarin.Forms.Sandbox/App.StartHere.cs b/Xamarin.Forms.Sandbox/App.StartHere.cs index 20b21e55d38..69a99b85590 100644 --- a/Xamarin.Forms.Sandbox/App.StartHere.cs +++ b/Xamarin.Forms.Sandbox/App.StartHere.cs @@ -9,11 +9,8 @@ public partial class App // This code is called from the App Constructor so just initialize the main page of the application here void InitializeMainPage() { - /*MainPage = new ContentPage() - { - Content = CreateStackLayout(new[] { new Button() { Text = "text" } }) - }; - MainPage.Visual = VisualMarker.Material;*/ + //MainPage = CreateStackLayoutPage(new[] { new Button() { Text = "text" } }); + //MainPage.Visual = VisualMarker.Material; MainPage = new MainPage(); } } diff --git a/Xamarin.Forms.Sandbox/MainPage.xaml b/Xamarin.Forms.Sandbox/MainPage.xaml index 0f0af41b359..c105aa29d58 100644 --- a/Xamarin.Forms.Sandbox/MainPage.xaml +++ b/Xamarin.Forms.Sandbox/MainPage.xaml @@ -1,10 +1,12 @@  + x:Class="Xamarin.Forms.Sandbox.MainPage" + xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core" + ios:Page.UseSafeArea="true"> -