--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<controls:TestContentPage xmlns:controls="clr-namespace:Xamarin.Forms.Controls" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Xamarin.Forms.Controls.Issues.Issue7886" >
+ <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
+ <!-- Place new controls here -->
+ <Label Text="Open the modal by the button below, then pop the modal by the Done toolbaritem. If you are back on the first page without a crash, this test succeeded!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
+ <Button AutomationId="{Binding ButtonAutomationId}" Text="Push Me" Clicked="Handle_Clicked" BackgroundColor="Aqua"/>
+ </StackLayout>
+</controls:TestContentPage>
--- /dev/null
+using System;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using NUnit.Framework;
+using Xamarin.UITest;
+using Xamarin.Forms.Core.UITests;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Github, 7886, "PushModalAsync modal page with Entry crashes on close for MacOS (NRE)", PlatformAffected.macOS)]
+ public partial class Issue7886 : TestContentPage
+ {
+
+ const string TriggerModalAutomationId = "TriggerModal";
+ const string PopModalAutomationId = "PopModal";
+
+ public string ButtonAutomationId { get => TriggerModalAutomationId; }
+
+ protected override void Init()
+ {
+ }
+
+#if APP
+ public Issue7886()
+ {
+ InitializeComponent();
+ BindingContext = this;
+ }
+
+ void Handle_Clicked(object sender, EventArgs e)
+ {
+ Navigation.PushModalAsync(new NavigationPage(new ModalPage()));
+ }
+
+ class ModalPage : ContentPage
+ {
+ public ModalPage()
+ {
+ BackgroundColor = Color.Orange;
+
+ var tbi = new ToolbarItem("Done", null, () => Navigation.PopModalAsync())
+ {
+ AutomationId = PopModalAutomationId
+ };
+
+ ToolbarItems.Add(tbi);
+
+ Content = new Entry
+ {
+ HorizontalOptions = LayoutOptions.Center,
+ VerticalOptions = LayoutOptions.Center
+ };
+ }
+ }
+#endif
+#if UITEST && __MACOS__
+ [Test]
+ public void NoNREOnPushModalAsyncAndBack()
+ {
+ RunningApp.WaitForElement(TriggerModalAutomationId);
+ RunningApp.Tap(TriggerModalAutomationId);
+ RunningApp.WaitForElement(PopModalAutomationId);
+ RunningApp.Tap(PopModalAutomationId);
+ }
+
+
+#endif
+ }
+
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Issue6127.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7283.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5395.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Issue7886.xaml.cs">
+ <DependentUpon>Issue7886.xaml</DependentUpon>
+ </Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue7898.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7525.xaml">
<Generator>UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7886.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla27417Xaml.xaml">
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7593.xaml">
<SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7758.xaml">
<SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue7789.xaml">
<SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
SetAutomationId(Element.AutomationId);
- SetAccessibilityLabel();
+
+ if (element != null)
+ SetAccessibilityLabel();
+
SetAccessibilityHint();
SetIsAccessibilityElement();
Performance.Stop(reference);