xamarin / Xamarin.Forms

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

[Bug] Crash in ButtonRenderer on iOS #13136

Closed samtun closed 3 years ago

samtun commented 3 years ago

Description

The ButtonRenderer crashes on iOS in version 4.8.0.1269 because the Element is null (probably disposed). There was a similar related issue once before https://github.com/xamarin/Xamarin.Forms/issues/11664 that got fixed in https://github.com/xamarin/Xamarin.Forms/pull/11668. But it was reintroduced with https://github.com/xamarin/Xamarin.Forms/commit/3a57e2e0200d5351e85d09d4f693fe65a7a4a8e8 because the Element is not checked for null there.

Steps to Reproduce

  1. Scroll fast in a ListView with button elements

Expected Behavior

no crash

Actual Behavior

The app crashes with the following stack trace:

System.NullReferenceException: Object reference not set to an instance of an object
  at Xamarin.Forms.Platform.iOS.ButtonRenderer.LayoutSubviews () [0x0001b] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ButtonRenderer.cs:89 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.0.0.0/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at Miele.Sandbox.iOS.Application.Main (System.String[] args) [0x00001] in /Users/fschipp/Projects/miele.modules.recipes/Sandbox/Sandbox.iOS/Main.cs:12 

Basic Information

Workaround

No workaround

samtun commented 3 years ago

Will this be merged into any 4.8 service release?

MitchBomcanhao commented 3 years ago

@samtun could you add which specific 4.8 version you found the issue on? "latest 4.8 version" isn't entirely clear when reading this retrospectively...