-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Xamarin caused by: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object. #2004
Comments
Please provide a reproduction. |
I can't make our production build to fail every time. Usually it happens every time at the start of the day but when I try to repeat it in a test app it stops happening on a device in production build as well. |
@kingces95 |
xp.zip
|
Took about 10 iterations on an 8.0 emulator to crash. |
I started seeing this in Xamarin.Forms 3.0 and 3.1 Pre
|
Same...been getting many of these in the App Center error dashboard. Not exactly sure how to reproduce reliably. |
Same issue here. It occurs (not consistently) when navigating towards a new instance of a page containing a ListView with custom ViewCells. Page was previously removed from the navigation stack in my case.
|
This is exactly my setup, too.
…On Wed, May 16, 2018, 4:06 AM Samih Alkeilani ***@***.***> wrote:
Same issue here. It occurs (not consistently) when navigating towards a
new instance of a page (containing a ListView with custom ViewCells) that
was already instantiated at least once. Page was previously removed from
the navigation stack in my case.
1. Creating "Page X" with ListView - ListView is filtered, changed a
little bit;
2. "Page X" is removed from the navigation Stack;
3. New instance of "Page X" is created => crash when navigating to
"Page X"
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2004 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEbY-r6bKZYHYsqKR8DStkZO4cLc6NLCks5ty93_gaJpZM4SZ0sv>
.
|
I reproduced the issue by manually triggering a garbage collection (
Does it work for you ? |
I am also struck with the same crash, Please let me know if any solution JniPeerMembers.AssertSelf Xamarin caused by: android.runtime.JavaProxyThrowable: System.ObjectDisposedException: Cannot access a disposed object. |
Only happen on Android (tested on Samsung Galaxy S6 - Android 7.0), sometimes after 2 min, sometimes running for hours without crash.
but even making it run on UI thread doesn't fix the issue.
|
I m having troubles to reproduce this with the sample attached. Anyone with a better and reliable reproduction ? |
@rmarinho and @PureWeen Total impacted users over the last month: 27 Most Affected Device
Most affected API
Affected OS Android versions are starting from 5.1.1 till 8.0.0. Actually every version we support (5.x, 6.x, 7.x and 8.x) is impacted. Impacted devices: Huawei P10, Huawei P10 lite, Huawei Honor 5C, Samsung Galaxy S6 to S9 (including + and edge versions), Samsung Galaxy A5, Wiko Jerry 2, HTC U Play, Fairphone FP2, Sony Xperia Z5. We update Xamarin.Forms and the related NuGet packages regularly (only stable channel). Now we are using: Visual Studio 2017 is always up-to-date (i.e. at the time of writing 15.7.6). |
What it's hurting even more is my reputation with the customer. |
Here's the nuget package from the PR Xamarin.Forms.3.3.0.726028.zip If anyone wants to test I've ran this through what reproduction cases I have and I'm not seeing the exception anymore. It should be available on the nightly feed this week as well if you want to wait for that. |
@duzenko Did the PureWeen's NuGet package fix the issue for you? After the update, I still get the following exception:
|
I will test it when released publicly. |
When testing can you delete your bin/obj and also uninstall the app from the device you are testing? If you are testing the nuget package I attached? Looking at your exception the line numbers look to correspond with a previous version and not the nuget. When I tested the nuget that's what I had to do to ensure it was using the latest and greatest. If you are still having issues is there a repro you could possibly give me? |
@PureWeen It does work now after I try your suggestion. Thank you. 👍 |
@RedasP On a side note the core cause of this looks to be from a bug with the Mono GC. |
One part to take note of as workaround
|
Thank you for going forward with this issue |
Adding [CachingStrategy="RecycleElement"] to your listview might help solve the issue. <ListView ItemsSource="{Binding Items}" CachingStrategy="RecycleElement" and avoid setting your ItemSource to null just clear() it. |
@cramirez070506 |
@PureWeen we had this issue despite having added the environment.txt as you described it. unless we did something wrong. |
@NPadrutt can you try https://www.nuget.org/packages/Xamarin.Forms/3.2.0.729530-pre2 |
We had to create some nasty work arounds to get the software out the door. But I will try it out once we refactored the code. |
@NPadrutt Alright. If you happen to have any stack traces laying around of the exception you were seeing that would be helpful :-) The problem is that this exception is basically the same as getting an NRE so it's hard to say whether your particular instance is related to this or not |
mh, I see. I'll let you know when I know more :) |
Preliminary tests of 3.2.0.729530-pre2 appear to have fixed this issue for my scenario!!! 😃 Many thanks and looking forward to GA. 👍 |
We are also seeing many of these in App Center and users are reporting crashes, so I thought I'd add a stacktrace.. The stacktrace contains Xamarin.Forms.BindableProperty references - and I see no trace of our code. Not sure if this is the same scenario that is mentioned as fixed in 3.2.0.729530-pre2 (?) JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
|
@ehuna that does look like the same issue. That stack trace looks like a cleanup operation that usually gets queue'd up so the trace doesn't link back to your code. If the Mono GC bug didn't exist then the code here would just properly cleanup the resource and be on its way. |
Does this look like the same issue? I got this exception when clicking on a list item which opens a new page, then going back to the list view page and scanning an item which triggers a search and looks like AutoCompleteRenderer (base type SearchBarRenderer) is disposed. If I simply scan from the list view page without going to the list item page and back again, it works fine.
|
@RedasP your exception looks different. AutoCompleteRenderer isn't something that's part of the core framework so it's hard to say what's causing your exception. It looks like the custom AutoCompleteRenderer is holding onto something it shouldn't be. If you can create a reproduction and create an issue we can look at it to see if there's an error on our side or not |
Description
This error occurs when navigating between pages with complex-row listviews. Since no user code is involved it's not possible to catch and handle the exception.
Steps to Reproduce
Intermittent.
Expected Behavior
Navigating pages does not cause crashes.
Actual Behavior
A crash occurs once in a while.
Basic Information
Reproduction
https://github.com/xamarin/Xamarin.Forms/files/2197967/disp2.zip
Exception happens here
Stack trace
The text was updated successfully, but these errors were encountered: