Call PushModalAsync to show a modal page containing an Entry control. Close the page. The app will crash.
Modal closes without problem.
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.MacOS.EntryRenderer.SetAccessibilityLabel () [0x0002c] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x00190] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.VisualElementRenderer1[TElement].Dispose (System.Boolean disposing) [0x0008c] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.ViewRenderer2[TView,TNativeView].Dispose (System.Boolean disposing) [0x0005c] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.EntryRenderer.Dispose (System.Boolean disposing) [0x00018] in <7bc93742592948de80da3cf37e3bec58>:0
at Foundation.NSObject.Dispose () [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.2.0.47/src/Xamarin.Mac/Foundation/NSObject2.cs:147
at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Dispose (System.Boolean disposing) [0x0003f] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Dispose () [0x00000] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.PageRenderer.Dispose (System.Boolean disposing) [0x00071] in <7bc93742592948de80da3cf37e3bec58>:0
at Foundation.NSObject.Dispose () [0x00001] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.2.0.47/src/Xamarin.Mac/Foundation/NSObject2.cs:147
at Xamarin.Forms.Platform.MacOS.DisposeHelpers.DisposeModalAndChildRenderers (Xamarin.Forms.Element view) [0x00041] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.ModalPageTracker+<>c__DisplayClass13_0.<HideModalAsync>b__0 () [0x00000] in <7bc93742592948de80da3cf37e3bec58>:0
at Xamarin.Forms.Platform.MacOS.NSViewControllerExtensions+<>c__DisplayClass0_01[T].
at ObjCRuntime.Trampolines+SDAction.Invoke (System.IntPtr block) [0x0001c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.2.0.47/src/Xamarin.Mac/Trampolines.g.cs:13463
at at (wrapper native-to-managed) ObjCRuntime.Trampolines+SDAction.Invoke(intptr)
at at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.2.0.47/src/Xamarin.Mac/AppKit/NSApplication.cs:100
at PushModal.Mac.MainClass.Main (System.String[] args) [0x00017] in /Users/denniswelu/Projects/_Sandbox/PushModal/PushModal.Mac/Main.cs:11
This is a follow-up issue while testing https://github.com/xamarin/Xamarin.Forms/issues/6866 . The only difference in the repro solution is the addition of a single line to the ModalPage.xaml:
<Entry Placeholder="Enter something here" WidthRequest="200" HorizontalOptions="Center" VerticalOptions="Center"/>
A workaround is possible by creating a derived EntryRenderer and overriding SetAccessibilityLabel:
protected override void SetAccessibilityLabel()
{
if (Control != null)
base.SetAccessibilityLabel();
}
Added a PR to fix this, thanks for reporting!
Awesome, amazing turnaround time there @jfversluis :-)
Did this change make it into the just-released 4.3.0 NuGet?
I'm getting that same exception using Xamarin.Forms 4.3.0.908675.
I think it just missed it. Sorry about that!
Be on the lookout for 4.4-pre1 which should be here soon or the first 4.3 service release that should definitely have this change
Closed by #7900