-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] Cannot access a disposed object. Object name: 'PageContainer'. #13537
Comments
Hi @stanios thanks for your feedback, it will be really hard to try to understand this without a proper reproduction, can you please upload a small sample with the code you use?. Thanks |
I'll provide stack traces from a debug session, if you still need more info let me know and i'll see what I can do. So it happens when we navigate away/to a page using shell navigation. It would seem like by the time the effect's OnDetached() is called, the page where the effect is on was already disposed of. I am seeing something weird thought, when we navigate to a page (using shell) the effect's OnDetached() is called first for that page and then the OnAttached() is called. This is the call stack of the page navigation that causes the crash down the line (see next call stack).
This is the call stack right before the crash
|
hi @rmarinho please let me know if you still require a repro project or if the info I've given was enough, thanks. |
A repro project would help with this investigation, thanks. |
okay i've attached a repro project. You just have to switch between the pages back and forth and you'll see the exception thrown. |
@stanios Does it happen on any specific device?. I have tried to reproduce on iPad 14.4 simulator without success. |
Confirming that I'm able to repro on the iPad 8th generation and iPad Pro 12.9" simulators on iOS 14.4. I'm also able to repro on an iPhone 7 device I see the following exception when switching between flyout tabs:
Another issue I noticed that could potentially be related is that switching between the tabs very quickly leaves only the color block in the UI. Will need to investigate further |
Description
Removing a gesture recognizer that's inside a page's effect throws an exception: Cannot access a disposed object. Object name: 'PageContainer'.
Steps to Reproduce
Not always reproducible, but essentially we need to have a PlatformEffect with a gesture recognizer on a Xamarin.Forms.ContentPage. When the effect in question calls its OnDetached method, we will remove the gesture recognizer from the view
Expected Behavior
no exception to be thrown
Actual Behavior
sometimes a Cannot access a disposed object. Object name: 'PageContainer' exception is thrown.
Basic Information
{
"length": 0,
"offset": 0,
"id": "33289256-779c-4472-8888-0ff5026e8e2d",
"exception": {
"type": "System.ObjectDisposedException",
"message": "Cannot access a disposed object.\nObject name: 'PageContainer'.",
"stackTrace": " at Foundation.NSObject.get_SuperHandle () <0x102098f50 + 0x000b8> in <cb9790ed00554382a298bf599d262d19#4922dbca770650d12adbda77259e98d2>:0 \n at UIKit.UIView.RemoveGestureRecognizer (UIKit.UIGestureRecognizer gestureRecognizer) <0x102064750 + 0x0005f> in <cb9790ed00554382a298bf599d262d19#4922dbca770650d12adbda77259e98d2>:0 \n at MyApp.iOS.Effects.TouchEffect.OnDetached () <0x10101d9e0 + 0x00047> in <7827dabf66d24c6d9cdc98f004d2651a#4922dbca770650d12adbda77259e98d2>:0 ",
"wrapperSdkName": "appcenter.xamarin"
},
"appId": "740135ec-5175-4c18-a6cd-5cb00b26883d",
"installId": "A063C386-E80A-40D8-BEC9-65E8B5CCD152",
"isTestMessage": false,
"timestamp": "2021-01-26T00:20:31.202Z",
"sid": "09155508-66a7-4eff-9cef-efdf6abc5711",
"userId": "4",
"device": {
"sdkName": "appcenter.ios",
"sdkVersion": "3.3.5+3621e27fb",
"wrapperSdkVersion": "3.4.3",
"wrapperSdkName": "appcenter.xamarin",
"model": "iPad5,3",
"oemName": "Apple",
"osName": "iOS",
"osVersion": "14.3",
"osBuild": "18C66",
"locale": "en_CA",
"timeZoneOffset": -240,
"screenSize": "2048x1536",
"appVersion": "5.0.4",
"appBuild": "14.0.4.10101",
"appNamespace": "com.MyApp",
"wrapperRuntimeVersion": "12.6.0"
}
}
Environment
Show/Hide Visual Studio info
The text was updated successfully, but these errors were encountered: