Xamarin.forms: [Bug] ListView with Label that uses FormattedText, MaxLines and LineBreakMode "TailTruncation" leads to crash: offset(x) should be less than line limit(y)

Created on 12 Feb 2020  路  5Comments  路  Source: xamarin/Xamarin.Forms

Description

App crashes/hangs (depending on version of android) if a ListView ItemTemplate contains a label with formatted text is configured to use MaxLines > 1 and LineBreakMode "TailTruncation" and depending on the actual text that is to be shown!

=> there seem to be a character that is not supported?

Crash reported at .LabelRenderer.onLayout
LabelRenderer.java, line 46
Java.Lang.RuntimeException: offset(129) should be less than line limit(15)

Steps to Reproduce

We will try to create a repro for this!

Expected Behavior

No hang/crash.

Actual Behavior

Hangs on android 7.1
Crashes on android 9,10

Basic Information

  • Version with issue: Xamarin.Forms 4.1.0.618606
  • Last known good version:
  • IDE: Visual Studio
  • Platform Target Frameworks:

    • Android: 9.0

  • Android Support Library Version:
    Xamarin.Android.Support.Design Version="28.0.0.1"
    Xamarin.Android.Support.v7.AppCompat Version="28.0.0.1"
    Xamarin.Android.Support.v4 Version="28.0.0.1"
    Xamarin.Android.Support.v7.CardView Version="28.0.0.1"
    Xamarin.Android.Support.v7.MediaRouter Version="28.0.0.1"
  • Nuget Packages:
  • Affected Devices:
    Android 7.1 emulator, Huawei P30pro, Samsung A50

    Screenshots

Reproduction Link

Workaround


Workaround is not using LineBreakMode "TailTruncation"

label listview 3 high Android bug up-for-grabs

Most helpful comment

I'm working on a solution and it's almost ready.

there seem to be a character that is not supported?

If you need more information on a workaround, the error happens if you use NewLine character ("\n" in android). Just do a converter that remove the character will prevent to break.

probably related to #5669, #8831 and #7534

Just to remember that this error it's related to #7534 only. #5669 is for 2 different erros in different platforms, and the second one, #8831, it's an iOS issue not related to this one.

All 5 comments

@gentledepp Thanks! We'll wait for the reproduction.

I managed to create a repro on Xamarin.Forms version 4.1.0.
See the following video:
repro_9539_short

PR for the repro will follow soon!

@bruzkovsky fyi! 馃榿

probably related to #5669, #8831 and #7534

I'm working on a solution and it's almost ready.

there seem to be a character that is not supported?

If you need more information on a workaround, the error happens if you use NewLine character ("\n" in android). Just do a converter that remove the character will prevent to break.

probably related to #5669, #8831 and #7534

Just to remember that this error it's related to #7534 only. #5669 is for 2 different erros in different platforms, and the second one, #8831, it's an iOS issue not related to this one.

Was this page helpful?
0 / 5 - 0 ratings