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

Closed
DennisWelu opened this issue Oct 9, 2019 · 5 comments
Closed

Comments

@DennisWelu
Copy link

@DennisWelu DennisWelu commented Oct 9, 2019

Description

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: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac
  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/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].b__0 () [0x0001b] in <7bc93742592948de80da3cf37e3bec58>:0
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

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

PushModal.zip

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)
                base.SetAccessibilityLabel();
        }
@jfversluis

This comment has been minimized.

Copy link
Member

@jfversluis jfversluis commented Oct 9, 2019

Added a PR to fix this, thanks for reporting!

@DennisWelu

This comment has been minimized.

Copy link
Author

@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
@JunielKatarn

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 4.3.0.908675.

@jfversluis

This comment has been minimized.

Copy link
Member

@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

@samhouts

This comment has been minimized.

Copy link
Member

@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
Projects
v4.3.0
  
Done
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.