Bug 19785 - Remove all Android permissions from AssemblyInfo.cs
Summary: Remove all Android permissions from AssemblyInfo.cs
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 3.0
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: dean.ellis
Depends on:
Reported: 2014-05-14 15:17 UTC by Jon Goldberger [MSFT]
Modified: 2014-06-05 08:17 UTC (History)
5 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 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 Jon Goldberger [MSFT] 2014-05-14 15:17:28 UTC
The AssemblyInfo.cs file in a template Android app includes these lines:

// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

At least the Ice Cream Sandwich template and the Android Class Library template have them, I have not checked all templates. This has caused some frustration as it is not the expected place to find permissions. 

This issue was reported on the forums: http://forums.xamarin.com/discussion/comment/53542#Comment_53542

Workaround: delete those lines from the file.
Comment 1 dean.ellis 2014-05-15 04:48:27 UTC
I those are mostly handy for debug purposes.. jonp perhaps we just need to wrap them in a #if DEBUG ?
Comment 2 dean.ellis 2014-05-15 04:48:59 UTC
I'll check xamarin studio if they don't do it either then we can remove them.
Comment 3 Jonathan Pryor 2014-05-15 10:36:28 UTC
I don't know why Permission.WriteExternalStorage is added. It's not present in the Xamarin Studio template, and the commit message which adds that permission doesn't provide a rationale.

Ostensibly Permission.Internet is required in order for the debugger to attach. However, the build process will ensure that INTERNET is automatically added in Debug builds, and thus isn't necessary within AssemblyInfo.cs. Furthermore, Xamarin Studio doesn't add this permission either.

It should be safe to remove both of those from the default template, and would make things more consistent with Xamarin Studio as well.
Comment 5 dean.ellis 2014-05-20 10:58:52 UTC
Fixed in XamarinVS/master/5478892369
Comment 6 Akhilesh kumar 2014-06-05 08:17:55 UTC
I have checked this issue with following builds:

VS 2013
Xamarin (c376d19d2984310ff50a6e741e3e3e9ce4f920a5)
Visual Studio extension to enable development for Xamarin.iOS and

I have checked this for Android Class Library template and now all Android permissions has been removed from AssemblyInfo.cs file. 

Screencast: http://www.screencast.com/t/8hJ9NLZDV

Hence, closing this issue.