Bug 34949 - Runtime permission int32[] does not implement IEnumerable<Android.Content.PM.Permission>
Summary: Runtime permission int32[] does not implement IEnumerable<Android.Content.PM....
Status: RESOLVED DUPLICATE of bug 34732
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 5.2
Hardware: PC Windows
: --- normal
Target Milestone: 7.0 (C8)
Assignee: Jonathan Pryor
Depends on:
Reported: 2015-10-16 12:51 UTC by Przemysław Raciborski
Modified: 2016-02-22 17:10 UTC (History)
4 users (show)

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:

Description Przemysław Raciborski 2015-10-16 12:51:24 UTC

Comment 1 Przemysław Raciborski 2015-10-16 12:53:17 UTC
I implemented runtime permission check according to: https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/ (using AppCompat) and my application crash with:

10-16 12:48:56.776 F/        (21088): System.Int32[] doesn't implement interface System.Collections.Generic.IEnumerable<Android.Content.PM.Permission>
10-16 12:48:56.776 F/libc    (21088): Fatal signal 6 (SIGABRT), code -6 in tid 21088 (rtpl.myAppName)
Comment 2 Przemysław Raciborski 2015-10-16 12:57:54 UTC
sorry invalid, my fault
Comment 3 David Barrett 2016-01-05 18:51:28 UTC
I'm not sure I follow how this is invalid.  Of course you can use a traditional for each statement, but why does using Linq throw this exception?
Comment 4 Jonathan Pryor 2016-01-16 03:44:51 UTC
Agreed, this is not invalid.

@David: It throws because the runtime type of the array is `int[]`, not `Permission[]`, and the reason for *that* is because our enum-array marshaling code creates arrays of the enum's underlying type. (That's the bug.)
Comment 5 David Barrett 2016-01-16 19:00:40 UTC
Thanks Jon.  I suspected it had to do with the Mono Android type vs. the underlying Java type.  Thank you for confirming.  For now I've just used a for each, no biggie.
Comment 6 Peter Collins 2016-02-22 17:10:01 UTC

*** This bug has been marked as a duplicate of bug 34732 ***