Xamarin.forms: [Bug] [iOS] [Regression] V4.2.0.778463 Crash when Unfocus Entry

Created on 17 Sep 2019  路  21Comments  路  Source: xamarin/Xamarin.Forms

Description

After updating from V4.2.0.709249 to V4.2.0.778463
Ios Entry crashed when unfocusing an entry

Steps to Reproduce

    <Style x:Key="BaseEntryStyle" TargetType="Entry">
        <Setter Property="FontSize" Value="{styling:Font 20}"/>
        <Setter Property="custom:KeyboardStyle.KeyboardFlags" Value="Spellcheck,CapitalizeSentence"/>
        <Setter Property="BackgroundColor" Value="White"/>
        <Setter Property="Keyboard" Value="Text"/>
        <Setter Property="TextColor" Value="{StaticResource SelectOneTextColour}"/>
        <Setter Property="PlaceholderColor" Value="{StaticResource PlaceHolderTextColour}"/>
        <Setter Property="IsSpellCheckEnabled" Value="True"/>
        <Setter Property="IsTextPredictionEnabled" Value="True"/>
        <Setter Property="ReturnType" Value="Done"/>
    </Style>

    <Style TargetType="Entry" BasedOn="{StaticResource BaseEntryStyle}"/>


<Entry x:Name="userName" IsSpellCheckEnabled="False" IsTextPredictionEnabled="False" AutomationId="UserNameControl" Grid.Column="1" custom:KeyboardStyle.KeyboardFlags="CapitalizeNone" Keyboard="Email" HorizontalTextAlignment="Center" Text="{Binding UserName}" FontSize="{styling:Font 20}" TextColor="{StaticResource DefaultTextColour}" Placeholder="{trans:Translate Email/UserName}" PlaceholderColor="{StaticResource SubtitleTextColour}" BackgroundColor="Transparent"/>

Focus the entry and then unfocus the entry and the application crashes with the following error

Object Reference Not Set
" at Xamarin.Forms.Platform.iOS.PageRenderer.GetAccessibilityElements () [0x000d4] in <307bb0d1b0ac4e7c9dc8252978e366cc>:0 \n at Xamarin.Forms.Platform.iOS.PageContainer.get_AccessibilityElements () [0x00008] in <307bb0d1b0ac4e7c9dc8252978e366cc>:0 \n at Xamarin.Forms.Platform.iOS.PageContainer.AccessibilityElementCount () [0x00000] in <307bb0d1b0ac4e7c9dc8252978e366cc>:0 \n at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)\n at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:86 \n at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/src/Xamarin.iOS/UIKit/UIApplication.cs:65 \n at FieldStrikeMove.iOS.Application.Main (System.String[] args) [0x00001] in /Users/chrisjohn/Documents/TFS/FieldStrike/FieldStrikeMove-dev/FieldStrikeMove.iOS/Main.cs:29 "

Linked to this merge https://github.com/xamarin/Xamarin.Forms/commit/f6cf100b80e1dc9de4b26affb7b8e8677b599bea#diff-d95827e5633c20beb139e10ccd1a40d9 I'd imagine

high regression iOS 馃崕 unverified bug

All 21 comments

@JKennedy24 Can you please attach a small project that demonstrates this issue? Thanks!

SfSample.zip

Hi @samhouts

I've attached a sample.

Steps to reproduce:

  1. open app on physical ios app (not sure if occurs on emulator)
  2. scroll down and press button "Entry View"
  3. Click either Entry on the view and type something, press "done"
  4. Crash

This crash occrus only when using Xamarin.Calabash.Start(); in the appdelegate, which made it extremely difficult to find. If i comment out that line the whole app works.

This basically means our release app works, but our UI tests crash. Which would classify this as a bit of a showstopping and I'm surprised no one else is also experiencing this

Hopefully you can shed some light on what is causing this.

Caused when upgrading from V4.2.0.709249 to V4.2.0.778463

I can confirm this bug still exists within v4.2.0.815419 too. I've not had success in identifying the cause in my code that triggers this issue, but similarly, the crash occurs when a button is clicked that triggers a navigation command and I receive the same Stacktrace as detailed above.

@AdenITD @samhouts

The cause is any form of CompressionLayout + the line Xamarin.Calabash.Start in the appdelegate

Remove either CompressionLayout or Calabash.Start from your code and the error goes away.

Why these two things together cause this issue is over my head which is why its with the xamarin team.

Pretty sure this should be a high priority as a lot of people doing iOS UI Tests who are using CompressionLayout will start to see this bug over the coming weeks

Yep, that checks out. The page causing the issue has a grid with CompressedLayout set as the root content. We don't have any UI tests (yet) so, given this can occur with just compressed layout, would have to agree that this should be addressed sooner rather than later, as it will impact perf.

@AdenITD Out of interest does your project contain Calabash at all? and or contain the line Xamarin.Calabash.Start ?

No, there's no reference that I can see and it's doubtful that the 3rd party library we use has it either.

Also @samhouts I've been able to recreate in a small app. I've found that occasionally, it will work, but for the most part it dies.

CompressedLayoutBug.zip

It's not just a performance that makes this issue a priority, it's that in complex production app, a crash can appear with no indication on the call stack of where it came from. The optimization becomes useless if reliability becomes a guessing game. The guidance for CompressedLayout should be updated to reflect the current reality.

any chance we get this issue assigned and investigated this sprint? Seems to be a regression and @AdenITD has provided a very good and simple sample

I updated Xamarin.Forms to 4.3.0.819712-pre2 and the problem went away for me. So it looks like it's fixed already.

Update: It turns it did still crash on 4.3.0.819712-pre2 (and pre3). Removing calls (even seemingly unrelated) to SetIsHeadless seem to be what actually caused the crash to not occur.

interesting, I'll give that a try and report back

@breyed @JKennedy24 The issue still exists in Xamarin.Forms 4.3.0.819712-pre2.

Here is a reproduction sample: https://github.com/brminnick/iOS13SimulatorEntryRepro

Thanks @brminnick !!! Reproduces immediately on my iPad

AFAICT this is fixed by

https://github.com/xamarin/Xamarin.Forms/pull/7566

@brminnick can you pull down the latest nightly for 4.4 and see if you still get the same crash?

I was able to reproduce the crash with your repro but once I updated to latest 4.4 nightly it seems to not crash

Thanks @PureWeen!

I too no longer experience the crash on v4.4.0.1225-nightly.

This issue isn't on the release notes for 4.3.0-sr1. What's the rollout plan?

@jfversluis When I search within the page for "7554" or "7566" or the bug title, I don't see it. Is it listed as something else?

@breyed The Pull Request for this fix referenced above, (https://github.com/xamarin/Xamarin.Forms/commit/327fa3c5e46af79802faacec48e17d38d7f1f75e), confirms the team has fixed the bug in the following releases:

  • 4.3.0-sr1
  • 4.3.0-rc1
  • 4.2.0-sr4
  • 4.4.0-pre1

Screen Shot 2019-10-31 at 6 59 27 AM

For me it's right there.

image

It shows up for me in the 4.3.0-sr1 release notes now, too.

Was this page helpful?
0 / 5 - 0 ratings