Bug 39751 - Populating list view in async method causes native crash (accessed deleted global reference)
Summary: Populating list view in async method causes native crash (accessed deleted gl...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.1.0
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-18 01:30 UTC by Cody Beyer (MSFT)
Modified: 2016-08-19 22:22 UTC (History)
5 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
Sample (53.19 KB, application/zip)
2016-03-18 01:30 UTC, Cody Beyer (MSFT)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Cody Beyer (MSFT) 2016-03-18 01:30:58 UTC
Created attachment 15455 [details]
Sample

# Description


The following sample app demonstrates an issue, where attempting to populate a ListView with data from an async method will, from time to time, cause a native crash, possibly a race condition 

# Sample

Attached

# Error

https://gist.github.com/CodyBeyer/d35a5fc5e37874b5ce00

# Steps to Reproduce 

Note: I could not reproduce it repeatedly. May need a few attempts 

1. Download sample
2. Deploy to Android emulator

# Expected Results

ListView (BasicX) should populate with 1000 items

# Actual Results

App crashes

# Versions

=== Xamarin Studio ===

Version 6.0 (build 4801)
Installation UUID: 3c5a3580-d902-45db-8f94-df4e19aba44a
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/f8474c4) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000040

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.2.1 (9548.1)
Build 7C1002

=== Xamarin.iOS ===

Version: 9.4.2.27 (Business Edition)
Hash: 58ba2bc
Branch: master
Build date: 2016-03-03 09:05:19-0500

=== Xamarin.Android ===

Version: 6.0.2.1 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.1.7 (Business Edition)

=== Build Information ===

Release ID: 600004801
Git revision: f73f730c738baf8701a5892b7af64fd468d1dc0c
Build date: 2016-03-14 14:28:06-04
Xamarin addins: 3af7be6c701eb0137645a03e38b82f23b65738c3
Build lane: monodevelop-lion-cycle7

=== Operating System ===

Mac OS X 10.11.3
Darwin clb-macbook-pro.local 15.3.0 Darwin Kernel Version 15.3.0
	Thu Dec 10 18:40:58 PST 2015
	root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
Comment 2 Samantha Houts [MSFT] 2016-08-19 22:22:32 UTC
With Xamarin.Forms 2.1, I was able to consistently reproduce this error by aborting the app and restarting it (e.g., restart debugging while the ListView is still populating). 

After upgrading the project to Xamarin.Forms 2.3.1 (latest stable), I can no longer reproduce the error. Thus, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report.

Warm regards, 
Xamarin Forms Team