Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] PushModalAsync modal page with Entry crashes on close for MacOS (NRE) #7886

DennisWelu opened this issue Oct 9, 2019 · 5 comments


Copy link

@DennisWelu DennisWelu commented Oct 9, 2019


Call PushModalAsync to show a modal page containing an Entry control. Close the page. The app will crash.

Steps to Reproduce

  1. Create a Xamarin Forms project from template
  2. Add the Mac project to it as per document:
  3. Add a page that can be used for a modal flow, and which contains an Entry control, and call Navigation.PushModalAsync to bring it up.
  4. Run the app. Bring up the modal, close it.

Expected Behavior

Modal closes without problem.

Actual Behavior

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/ 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/ 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].b__0 () [0x0001b] in <7bc93742592948de80da3cf37e3bec58>:0
at ObjCRuntime.Trampolines+SDAction.Invoke (System.IntPtr block) [0x0001c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/
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/
at PushModal.Mac.MainClass.Main (System.String[] args) [0x00017] in /Users/denniswelu/Projects/_Sandbox/PushModal/PushModal.Mac/Main.cs:11

Basic Information

  • Version with issue: 4.3.0-pre3
  • Last known good version: ?
  • IDE: VS for Mac
  • Platform Target Frameworks:
    • MacOS: 10.14

Reproduction Link

Additional Info

This is a follow-up issue while testing #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)

This comment has been minimized.

Copy link

@jfversluis jfversluis commented Oct 9, 2019

Added a PR to fix this, thanks for reporting!


This comment has been minimized.

Copy link

@DennisWelu DennisWelu commented Oct 9, 2019

Awesome, amazing turnaround time there @jfversluis :-)

@samhouts samhouts added the in-progress label Oct 9, 2019
@samhouts samhouts added this to In Progress in v4.3.0 Oct 9, 2019
@samhouts samhouts removed this from Ready For Work in Triage Oct 9, 2019
@samhouts samhouts moved this from In Progress to Done in v4.3.0 Oct 18, 2019

This comment has been minimized.

Copy link

@JunielKatarn JunielKatarn commented Oct 22, 2019

Did this change make it into the just-released 4.3.0 NuGet?
I'm getting that same exception using Xamarin.Forms


This comment has been minimized.

Copy link

@jfversluis jfversluis commented Oct 22, 2019

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


This comment has been minimized.

Copy link

@samhouts samhouts commented Oct 31, 2019

Closed by #7900

@samhouts samhouts closed this Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.