There is a crash in Xamarin.Forms 4.6.0.772 and newer on android during screen orientation changes. I have tested it on a blank app and it also crashes.
Screen content rotates
App crashes
Roll back to version 4.6.0.726
Same here - Android apps crashing on screen rotation after upgrading to: Xamarin.Forms v4.6.0.772. This includes blank android apps. iOS has no issue.
Downgrading to: v4.6.0.726. fixes the issue.
Same thing happening here on iOS when the application is moved to the background.
Happens on both Simulator targeting 13.4 and on an iPhone 7+ (iOS 13.4)
StackTrace:
at Xamarin.Forms.Internals.EnumerableExtensions.IndexOf[T] (System.Collections.Generic.IEnumerable`1[T] enumerable, T item) [0x00003] in
:0 \n at Xamarin.Forms.Application.OnRequestedThemeChanged (Xamarin.Forms.AppThemeChangedEventArgs args) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Application.cs:172 \n at Xamarin.Forms.Platform.iOS.PageRenderer.TraitCollectionDidChange (UIKit.UITraitCollection previousTraitCollection) [0x00021] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:373 \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/13.16.0.13/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/13.16.0.13/src/Xamarin.iOS/UIKit/UIApplication.cs:65 \n at IdentifEye.iOS.Application.Main (System.String[] args) [0x00002] in /Users/dhewitson/IdentifEye/IdentifEye/IdentifEye.iOS/Main.cs:15 "
Does downgrading to v4.6.0.726 fixes your issue @dhewitson ?
@realivanjx yes it does
Same thing happened to me today, downgraded and problem disappeared
Hadn't noticed before but I also get the same issue as @dhewitson on iOS.
Thanks for the feedback to everyone. This PR should fix this issue: https://github.com/xamarin/Xamarin.Forms/pull/10714
Same here. Our workaround for Android until #10714 is merged:
```c#
// MainActivity.cs
public override void OnConfigurationChanged(Configuration newConfig)
{
if (Device.Flags == null)
{
Device.SetFlags(new List<string>());
}
base.OnConfigurationChanged(newConfig);
}
```
should be fixed here
https://www.nuget.org/packages/Xamarin.Forms/4.6.0.800
Im also seeing this crash on iOS on 4.7.0.1080 when I rotate the screen
at Xamarin.Forms.Platform.iOS.VisualElementTracker.ShouldUpdateClip () [0x00037] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:452
at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateClip () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:394
at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateNativeControl () [0x0006c] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:386
at Xamarin.Forms.Platform.iOS.VisualElementTracker.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00064] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementTracker.cs:97
at (wrapper delegate-invoke).invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:229
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:353
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:461
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x00042] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:334
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindablePropertyKey propertyKey, System.Object value) [0x0000e] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:318
at Xamarin.Forms.VisualElement.set_Width (System.Double value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:451
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00013] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1080
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:316
at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:708
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
at Xamarin.Forms.TemplatedView.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\TemplatedView.cs:29
at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x00158] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:266
at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:224
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:812
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:1083
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:316
at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:708
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Xamarin.Forms.Rectangle region) [0x001da] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:178
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.LayoutSubviews () [0x00081] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\ViewCellRenderer.cs:97
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/13.18.2.1/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/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at JobTask.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\John\source\repos\JobTask\JobTask\JobTask.iOS\Main.cs:12
@jdinnen That should be fixed by SR2, which will be out later today. Thanks for your patience!
@jdinnen That should be fixed by SR2, which will be out later today. Thanks for your patience!
Seems to be good in 4.7.0.1142, thank you!
Sorry but it's still happening in iOS when you have a CollectionView filled in a ContentPage.
If the CollectionView has no lines this didn't happening.
Xamarin Forms: 4.8.0.1364
iPhone 11 iOS 13.7 (simulator)
2020-09-15 16:25:05.933455+0200 Rabbit2.iOS[96613:9707274] [Snapshotting] Snapshotting a view (0x7fcd0f859aa0, Xamarin_Forms_Platform_iOS_VerticalCell) that is not in a visible window requires afterScreenUpdates:YES.
2020-09-15 16:25:08.385726+0200 Rabbit2.iOS[96613:9707274] [AppCenterCrashes] ERROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/10 Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.VerticalCell.Measure () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\VerticalCell.cs:18
at Xamarin.Forms.Platform.iOS.TemplatedCell.PreferredLayoutAttributesFittingAttributes (UIKit.UICollectionViewLayoutAttributes layoutAttributes) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\TemplatedCell.cs:55
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/13.20.2.2/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/13.20.2.2/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at Rabbit2.iOS.Application.Main (System.String[] args) [0x00001] in /Users/joaofortes/Documents/Dev/Rabbit/Rabbit2/Rabbit2/Rabbit2.iOS/Main.cs:17
2020-09-15 16:25:08.401295+0200 Rabbit2.iOS[96613:9707274] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at Xamarin.Forms.Platform.iOS.VerticalCell.Measure () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\VerticalCell.cs:18
at Xamarin.Forms.Platform.iOS.TemplatedCell.PreferredLayoutAttributesFittingAttributes (UIKit.UICollectionViewLayoutAttributes layoutAttributes) [0x00007] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\TemplatedCell.cs:55
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/13.20.2.2/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/13.20.2.2/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at Rabbit2.iOS.Application.Main (System.String[] args) [0x00001] in /Users/joaofortes/Documents/Dev/Rabbit/Rabbit2/Rabbit2/Rabbit2.iOS/Main.cs:17
Same here.
Most helpful comment
Same here. Our workaround for Android until #10714 is merged:
```c#
// MainActivity.cs
```