xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.88k forks source link

[Bug][iOS] Label Text is truncated with long text. #15201

Open wadebaird opened 2 years ago

wadebaird commented 2 years ago

Description

With long text in a label control, it will eventually start truncating the entire next line of text.

Steps to Reproduce

Here is a complete reproduction: https://github.com/wadebaird/LabelBugApp

  1. Create a new View

  2. Add this xaml:

    (If I remove the StackLayout I still get the same behavior it just breaks on a different line).

  3. Load in an iOS simulator

Expected Behavior

All of the text is displayed on the screen.

Actual Behavior

Everything that is on the next row from " and some more and some more to get it." does not display on the screen. If you add 2 more characters to the end of the string it will show the text. If you add more words that move onto the next line, then those words will not be shown onto the screen until you reach the entire width of the screen.

Basic Information

Environment

Show/Hide Visual Studio info Microsoft Visual Studio Community 2022 Version 17.1.0 VisualStudio.17.Release/17.1.0+32210.238 Microsoft .NET Framework Version 4.8.04084 Installed Version: Community Visual C++ 2022 00482-90000-00000-AA137 Microsoft Visual C++ 2022 .NET Core Debugging with WSL 1.0 .NET Core Debugging with WSL ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools ASA Service Provider 1.0 ASP.NET and Web Tools 2019 17.1.358.51495 ASP.NET and Web Tools 2019 ASP.NET Web Frameworks and Tools 2019 17.1.358.51495 For additional information, visit https://www.asp.net/ Azure App Service Tools v3.0.0 17.1.358.51495 Azure App Service Tools v3.0.0 Azure Data Lake Tools for Visual Studio 2.6.5000.0 Microsoft Azure Data Lake Tools for Visual Studio Azure Functions and Web Jobs Tools 17.1.358.51495 Azure Functions and Web Jobs Tools Azure Stream Analytics Tools for Visual Studio 2.6.5000.0 Microsoft Azure Stream Analytics Tools for Visual Studio C# Tools 4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. Cookiecutter 17.0.21344.1 Provides tools for finding, instantiating and customizing templates in cookiecutter format. Extensibility Message Bus 1.2.6 (master@34d6af2) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events IncrediBuild Build Acceleration 1.6.0.2 IncrediBuild effectively reduces compilation and development times by up to 90%. Microsoft Azure Hive Query Language Service 2.6.5000.0 Language service for Hive query Microsoft Azure Service Fabric Tools for Visual Studio 17.0 Microsoft Azure Service Fabric Tools for Visual Studio Microsoft Azure Stream Analytics Language Service 2.6.5000.0 Language service for Azure Stream Analytics Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Microsoft Library Manager 2.1.161+abc97ecc7d.RR Install client-side libraries easily to any web project Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards Microsoft Visual Studio Tools for Containers 1.2 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container. Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package Mono Debugging for Visual Studio 17.1.10 (65f98f5) Support for debugging Mono processes with Visual Studio. Node.js Tools 1.5.40105.1 Commit Hash:1822ee94b29c6cf748a19825f14cc26d30b0b871 Adds support for developing and debugging Node.js apps in Visual Studio NuGet Package Manager 6.1.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Office Developer Tools for Visual Studio 17.0.32009.00 Microsoft Office Developer Tools for Visual Studio Python - Django support 17.0.21344.1 Provides templates and integration for the Django web framework. Python - Profiling support 17.0.21344.1 Profiling support for Python projects. Python with Pylance 17.0.21344.1 Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers. Razor (ASP.NET Core) 17.0.0.2206201+62a2c1d6162f828801565a7ca26d9d48b810a05b Provides languages services for ASP.NET Core Razor. SQL Server Data Tools 17.0.62201.12090 Microsoft SQL Server Data Tools Syntax Visualizer 1.0 An extension for visualizing Roslyn SyntaxTrees. ToolWindowHostedEditor 1.0 Hosting json editor into a tool window TypeScript Tools 17.0.1229.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.1.0-5.22109.6+0c82c4114a4e4b8b723b915eee3b13261db6717f Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used. Visual F# Tools 17.1.0-beta.21610.4+07b5673e4f2fa7630e78abe37f16b372353a7242 Microsoft Visual F# Tools Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio Visual Studio Container Tools Extensions 1.0 View, manage, and diagnose containers within Visual Studio. Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Foo 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio Workflow Manager Tools 1.0 1.0 This package contains the necessary Visual Studio integration components for Workflow Manager. Xamarin 17.1.0.309 (d17-1@3f96c58) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.1.0.87 (remotes/origin/main@d50fb5635) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.1.8 (590388a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 12.2.0.4 (d17-1/19b97b7) Xamarin.Android Reference Assemblies and MSBuild support. Mono: a5d1934 Java.Interop: xamarin/java.interop/d17-1@7ac33610 ProGuard: Guardsquare/proguard/v7.0.1@912d149 SQLite: xamarin/sqlite/3.37.1@0893b3b Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-1@db125a7 Xamarin.iOS and Xamarin.Mac SDK 15.6.0.3 (caa899d24) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

N/A

Screenshots

2022-03-03_10-37-01-AM 2022-03-03_10-55-36-AM

Reproduction Link

https://github.com/wadebaird/LabelBugApp

Workaround

I cannot find a workaround.

somoreingold commented 2 years ago

@wadebaird You're not alone in this one. There are many similar reports, one of which has made into the service release schedule last autumn: https://github.com/xamarin/Xamarin.Forms/issues/13683 Hopefully it's still on the radar, but I've since refactored my code to avoid the issue.

wadebaird commented 2 years ago

Thanks @somoreingold. How did you refactor your code to avoid it? I haven't found a work around.

somoreingold commented 2 years ago

"Workaround" is a strong word for what I did :) https://github.com/xamarin/Xamarin.Forms/issues/13683#issuecomment-1013404816 However it was either that, or digging deeper into Xamarin core code for an (unpredictable) amount of time, to try to make a PR that could be eventually merged. My team's launch constraints wouldn't allow for that timeline since Label text wrapping is a pretty crucial feature for our particular apps, and the bug was happening in a lot of important places.