Bug 34076 - Android.Runtime.JavaCollection<T>.CopyTo in Mono.Android.dll lacking null check
Summary: Android.Runtime.JavaCollection<T>.CopyTo in Mono.Android.dll lacking null check
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: High normal
Target Milestone: C6SR1
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-09-18 17:28 UTC by Nat Friedman
Modified: 2015-11-23 05:38 UTC (History)
3 users (show)

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

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:
VERIFIED FIXED

Description Nat Friedman 2015-09-18 17:28:23 UTC
## Overview

Customer reports that the implementation of Android.Runtime.JavaCollection<T>.CopyTo is lacking a IntPtr.Zero check on JavaCollection.id_toArray. 

## Description

Using the Xamarin Studio assembly browser, the code for this method seems to be:

https://gist.github.com/natfriedman/ec8a943289563bf0bd96

Indeed, there is no IntPtr.Zero check.

The customer states that they work around this by manually iterating over the collection, as GetEnumerator() does not contain the same bug. 

## Versions

The customer's Xamarin.Android version is Xamarin.Android 5.1.4.16 (5f55a9ef61c11b6ce0890bc91e4c71b1b92be214)

The full version info is here: https://gist.github.com/natfriedman/2f271f70aeb4a739e0d9
Comment 2 Jonathan Pryor 2015-09-21 16:44:37 UTC
Fixed in monodroid/57822ef0.
Comment 3 David Schwegler 2015-09-21 17:08:58 UTC
Thanks Jon. Where do I check what release that will be in?
Comment 4 Jonathan Pryor 2015-09-22 15:26:30 UTC
> Where do I check what release that will be in?

Release notes. Or the Target Milestone (which wasn't previously set), though that's frequently only a guideline (e.g. if a "new" "hotfoot" release is inserted before the "expected" C6SR1, that will "push down" the expected release numbers, so at best Target Milestone is only a guideline.)
Comment 5 Abhishek 2015-11-23 05:38:16 UTC
I have checked this issue with the latest master build both on Mac and Windows:
mono-android-6.0.99-217_e99cfefdfb9791d0efcae4f7d613753512d12f05. 
Xamarin.VisualStudio_99.0.0.751_c9c91d5787facd9e0aa13c7ee38a5611b774be5f
XamarinStudio-5.11.0.457_a7f371803e977c9e370808aaf3a5e2e73d76934d
Now this issue is working fine. 

screencast for Mac XS: http://www.screencast.com/t/KgqQVPznh
Screencast for Windows XS: http://www.screencast.com/t/AxfLl7vaXu

Hence closing the issue.

Thanks!