Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] NullReferenceException in EntryRenderer on iOS versions <14.X with ClearButtonVisibility.WhileEditing and non-default TextColor #14523

Closed
lee-m opened this issue Aug 20, 2021 · 1 comment · Fixed by #14566
Assignees
Projects

Comments

@lee-m
Copy link
Contributor

lee-m commented Aug 20, 2021

Description

On iOS, if an Entry control has its ClearButtonVisibility set to WhileEditing and a non-default TextColor, a NullReferenceException is thrown when the page is pushed on iOS 12 and 11. It doesn't crash on iOS 14.X.

This seems to be a regression from SR4 as the code in question was added in that release for #12391 which notes "Tint the clear button image in iOS"

The first part of the stack trace is shown below:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.EntryRendererBase1[TControl].GetClearButtonTintImage (UIKit.UIImage image, UIKit.UIColor color) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\EntryRenderer.cs:591 at Xamarin.Forms.Platform.iOS.EntryRendererBase1[TControl].UpdateClearButtonColor () [0x00086] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\EntryRenderer.cs:581
at Xamarin.Forms.Platform.iOS.EntryRendererBase1[TControl].UpdateClearButtonVisibility () [0x00020] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\EntryRenderer.cs:559 at Xamarin.Forms.Platform.iOS.EntryRendererBase1[TControl].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x001a5] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\EntryRenderer.cs:154 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x00172] in

Steps to Reproduce

Run the attached test project on iOS 11/12.
Repro.zip

Expected Behavior

Don't crash

Actual Behavior

Crashed with a NullReferenceException

Basic Information

  • Version with issue: 5.0.0.2083
  • Last known good version: 5.0.0.2012
  • Platform Target Frameworks:
    • iOS: 11.4, 12.4

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.10.7 (build 17)
Installation UUID: 32f8cdd9-06e3-44c2-bd38-08024b74d621
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000140

=== Mono Framework MDK ===

Runtime:
Mono 6.12.0.140 (2020-02/51d876a041e) (64-bit)
Package version: 612000140

=== Xamarin Designer ===

Version: 16.10.0.119
Hash: 36a2d986f
Branch: remotes/origin/d16-10
Build date: 2021-06-02 19:41:34 UTC

=== Roslyn (Language Service) ===

3.10.0-4.21269.26+029847714208ebe49668667c60ea5b0a294e0fcb

=== NuGet ===

Version: 5.9.0.7134

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.400/Sdks
SDK Versions:
5.0.400
5.0.302
5.0.301
5.0.203
5.0.201
5.0.101
5.0.100
3.1.412
3.1.411
3.1.410
3.1.409
3.1.407
3.1.404
3.1.402
3.1.401
3.1.301
3.1.300
3.1.202
3.1.200
3.1.101
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
5.0.9
5.0.8
5.0.7
5.0.6
5.0.4
5.0.1
5.0.0
3.1.18
3.1.17
3.1.16
3.1.15
3.1.13
3.1.10
3.1.8
3.1.7
3.1.5
3.1.4
3.1.2
3.1.1
2.1.23
2.1.22
2.1.21
2.1.19
2.1.18
2.1.17
2.1.16
2.1.15

=== .NET Core 3.1 SDK ===

SDK: 3.1.412

=== Xamarin.Profiler ===

Version: 1.6.15.68
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.5.1 (18212)
Build 12E507

=== Xamarin.Mac ===

Version: 7.14.0.24 (Visual Studio Community)
Hash: c4b89cddb
Branch: d16-10
Build date: 2021-06-15 22:03:00-0400

=== Xamarin.iOS ===

Version: 14.20.0.24 (Visual Studio Community)
Hash: c4b89cddb
Branch: d16-10
Build date: 2021-06-15 22:03:01-0400

=== Xamarin.Android ===

Version: 11.3.0.4 (Visual Studio Community)
Commit: xamarin-android/d16-10/ae14caf
Android SDK: /Users/gee7ironbridge/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
None installed

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 30.0.4
SDK Build Tools Version: 30.0.2

Build Information:
Mono: b4a3858
Java.Interop: xamarin/java.interop/d16-10@f39db25
ProGuard: Guardsquare/proguard@912d149
SQLite: xamarin/sqlite@85460d3
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-10@c5732a0

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/gee7ironbridge/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.10.0.12
Hash: e240b8c
Branch: remotes/origin/d16-10
Build date: 2021-08-03 17:48:52 UTC

=== Android Device Manager ===

Version: 16.10.0.14
Hash: e340248
Branch: remotes/origin/d16-10
Build date: 2021-08-03 17:49:10 UTC

=== Build Information ===

Release ID: 810070017
Git revision: 503b9b053dff2e7f136e96b362a629c199f78a42
Build date: 2021-08-05 12:48:29-04
Build branch: release-8.10

=== Operating System ===

Mac OS X 10.16.0
Darwin 20.6.0 Darwin Kernel Version 20.6.0
Wed Jun 23 00:26:31 PDT 2021
root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Show/Hide Visual Studio info

Reproduction Link

Workaround

Don't set ClearButtonVisibility to WhileEditing or don't change TextColor

@lee-m lee-m added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 20, 2021
@lee-m
Copy link
Contributor Author

lee-m commented Aug 20, 2021

Dupe of #14479 which I hadn't noticed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Triage
  
Ready For Work
Development

Successfully merging a pull request may close this issue.

2 participants