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

[Bug] 'Cannot access a disposed object. Object name: 'DefaultRenderer' - on ios with CollectionView and EmptyView #12910

Closed
themronion opened this issue Nov 19, 2020 · 6 comments · Fixed by #12923
Assignees
Labels
a/collectionview i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 t/bug 🐛
Projects

Comments

@themronion
Copy link

Description

Getting a crash when using emptyview with collectionview on iOs. XAMARIN FORMS 5, LATEST PRE-RELEASE!

**System.ObjectDisposedException:** 'Cannot access a disposed object.
Object name: 'DefaultRenderer'.'

2020-11-19 16:45:28.625075+0200 MobilAutoNew.iOS[11825:280616] 
Unhandled Exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'DefaultRenderer'.
  at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/Foundation/NSObject2.cs:394 
  at UIKit.UIView.set_Frame (CoreGraphics.CGRect value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIView.g.cs:3733 
  at Xamarin.Forms.Platform.iOS.ItemsViewController`1[TItemsView].LayoutEmptyView () [0x0000f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:300 
  at Xamarin.Forms.Platform.iOS.ItemsViewController`1[TItemsView].ViewWillLayoutSubviews () [0x0003a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:163 
  at Xamarin.Forms.Platform.iOS.StructuredItemsViewController`1[TItemsView].ViewWillLayoutSubviews () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.i
OS\CollectionView\StructuredItemsViewController.cs:78 
  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.2.0.12/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.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MobilAutoNew.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\pavlo\source\repos\MobilAutoNew\MobilAutoNew.iOS\Main.cs:17
2020-11-19 16:45:28.627630+0200 MobilAutoNew.iOS[11825:280616] Unhandled managed exception: Cannot access a disposed object.
Object name: 'DefaultRenderer'. (System.ObjectDisposedException)
  at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xam
arin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/Foundation/NSObject2.cs:394 
  at UIKit.UIView.set_Frame (CoreGraphics.CGRect value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIView.g.cs:3733 
  at Xamarin.Forms.Platform.iOS.ItemsViewController`1[TItemsView].LayoutEmptyView () [0x0000f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:300 
  at Xamarin.Forms.Platform.iOS.ItemsViewController`1[TItemsView].ViewWillLayoutSubviews () [0x0003a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewController.cs:163 
  at Xamarin.Forms.Platform.iOS.StructuredItemsViewController`1[TItemsView].ViewWillLayoutSubviews () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\StructuredItemsViewController.cs:78 
  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) [0x000
05] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/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.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MobilAutoNew.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\pavlo\source\repos\MobilAutoNew\MobilAutoNew.iOS\Main.cs:17

Steps to Reproduce

  1. make a collectionView
  2. Add an emptyView
    similat to this one
<CollectionView.EmptyView>
                    <StackLayout>
                        <Label HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Text="{Binding LoadingOrEmpty}" FontAttributes="Bold"/>
                    </StackLayout>
                </CollectionView.EmptyView>
  1. Try to scroll and Observe the crash

Environment

!!!Xamarin Forms 5, latest prerelease
Microsoft Visual Studio Community 2019, 16.7.7

@themronion themronion added s/unverified New report that has yet to be verified t/bug 🐛 labels Nov 19, 2020
@samhouts samhouts added this to New in Triage Nov 19, 2020
@jsuarezruiz jsuarezruiz added a/collectionview i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 labels Nov 19, 2020
@jsuarezruiz
Copy link
Contributor

@themronion Could you attach a sample where reproduce the issue?.

@jsuarezruiz jsuarezruiz self-assigned this Nov 19, 2020
@themronion
Copy link
Author

Yeap, i'll try to reproduce this bug in a blank project tomorrow and send the sample here

@VladislavAntonyuk
Copy link
Contributor

Duplicate #12894

I attached the repro

@jsuarezruiz
Copy link
Contributor

I have a repro sample @themronion, seems to be the same as #12894

@jsuarezruiz jsuarezruiz moved this from New to Ready For Work in Triage Nov 20, 2020
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Nov 20, 2020
@themronion
Copy link
Author

Yeap, seems to be similar

@Redth Redth moved this from Ready For Work to Needs Estimate in Triage Nov 30, 2020
@themronion
Copy link
Author

Fixed in latest pre release. Can be closed

Triage automation moved this from Needs Estimate to Closed Dec 11, 2020
rmarinho pushed a commit that referenced this issue Dec 11, 2020
…12923) fixes #12910 fixes #12894

* Added repro sample

* Updated sample

* Updated repro sample

* Fix build error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often p/iOS 🍎 t/bug 🐛
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

3 participants