Skip to content

get_GestureRecognizers from UITableView crash regression. #6782

Closed

Description

@viniciusjarina
  • Xamarin.iOS regression was causing previewer to crash reading the property GestureReconizers from UITableView

TL;DR: The previewer was crashing for a few scenarios, and rendering ItemPage.xaml from the Master Detail template.

From stack trace it seems that the GestureReconizer of the ContextActionCell was (maybe?) collected or disposed, when UIKit calls GetCell or LayoutSubviews, which calls SetupSelection https://github.com/xamarin/Xamarin.Forms/blob/57d507ef0b47d54d4026a07632f88a39a40de0c9/Xamarin.Forms.Platform.iOS/ContextActionCell.cs#L646 the GestureReconizer isn't there anymore, and X.iOS tries to resurrect it, causing a MissingCtor exception

https://gist.github.com/viniciusjarina/407952739b7f19eee15df6a5a021192b

  • This was a regression between 12.2.1.16 - 12.6.0.25

831M4l0BRx

VS bug #966689

Activity

  1. added
    iOS
    vs-sync
    on Aug 15, 2019
  2. spouliot commented on Aug 15, 2019

    @spouliot
    Contributor

    @viniciusjarina please avoid vs-sync (we'll apply it it) as it double the triaging work.

    I don't understand your screencast... what is wrong ? I don't see any crash
    There's also nothing that tell us how to duplicate this issue.

    IIRC there was a change in GestureRecognizers recently - but it was to allow it to be GC'ed properly (they were not). So it's quite possible that some incorrect code will have to be fixed.

    Also the code you linked https://github.com/xamarin/Xamarin.Forms/blob/57d507ef0b47d54d4026a07632f88a39a40de0c9/Xamarin.Forms.Platform.iOS/ContextActionCell.cs#L646 is racy since each call to table.GestureRecognizers can return a different array, so it can be non-null of the first check, then null later (or with a different number of items).

    The fix is simple, assign table.GestureRecognizers to a local variable and use it - that way all the logic will be applied to the same data. It will also cut down on memory allocations, which is always a good thing :)

  3. added this to the Future milestone on Aug 15, 2019
  4. added
    need-info
    on Aug 15, 2019
  5. viniciusjarina commented on Aug 15, 2019

    @viniciusjarina
    Author

    The screencast was from the Forms PR, is working. I've added the vs-sync because I've added the repro details in the AzDO bug. 😉

    I agree that code is kinda of "racy" but should not crash the application, correct?

  6. chamons commented on Sep 18, 2019

    @chamons
    Contributor

    We have not received the requested information.

    If you are still experiencing this issue please provide all the requested information then click the Reopen Issue button.

    Thanks!

  7. ghost locked as resolved and limited conversation to collaborators on May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    iOSneed-infovs-sync

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions