Bug 40059 - Using IntentFilterAttribute.Data* string[] does not generate the respective value
Summary: Using IntentFilterAttribute.Data* string[] does not generate the respective v...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.0.1 (C6SR1)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-04-01 17:45 UTC by Jon Douglas [MSFT]
Modified: 2016-04-06 01:20 UTC (History)
2 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 Jon Douglas [MSFT] 2016-04-01 17:45:04 UTC

There is a set of Data string[] IntentFilterAttributes that one can use for adding <data /> tags to the Intent Filter. However these items seem to not generate correctly and are not documented in the Xamarin.Android API definition. Instead they only generate an empty <data /> tag for each item:


Definition of each string[]:

    public string[] DataHosts { get; set; }

    public string[] DataMimeTypes { get; set; }

    public string[] DataPaths { get; set; }

    public string[] DataPathPatterns { get; set; }

    public string[] DataPathPrefixes { get; set; }

    public string[] DataPorts { get; set; }

    public string[] DataSchemes { get; set; }

Given the simple IntentFilterAttribute code:

       new[] { Intent.ActionView },
       Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
       DataSchemes = new string[]

Note: You can use any Data* string[] here from the list above and it will just generate empty <data />

We see that the generated AndroidManifest.xml does not behave in the same manner as expected:

        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data />
        <data />
        <data />
        <data />

Instead we see empty data tags. Ideally we should see the following for each data tag.

        <data android:scheme="http" />
        <data android:scheme="https" />
        <data android:scheme="content" />
        <data android:scheme="file" />

Now there are some defined limitations to Intent-Filters and the <data> element that can be described here:



Each <data> element can specify a URI structure and a data type (MIME media type). There are separate attributes — scheme, host, port, and path — for each part of the URI:


Each of these attributes is optional in a <data> element, but there are linear dependencies:

If a scheme is not specified, the host is ignored.
If a host is not specified, the port is ignored.
If both the scheme and host are not specified, the path is ignored.



1. One can use the singular versions of these Data* string[] attributes instead with multiple Intent-Filters.

    public string DataHost { get; set; }

    public string DataMimeType { get; set; }

    public string DataPath { get; set; }

    public string DataPathPattern { get; set; }

    public string DataPathPrefix { get; set; }

    public string DataPort { get; set; }

    public string DataScheme { get; set; }

2. One can manually edit the AndroidManifest.xml to include the proper definition. (Be wary of it regenerating over existing definitions)


1. Create a File->New Android Project
2. Add an Intent-Filter with one of the examples above the MainActivity.cs


       new[] { Intent.ActionView },
       Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
       DataSchemes = new string[]
    public class MainActivity : Activity

3. View the generated AndroidManifest.xml in obj\Debug\android\AndroidManifest.xml

*Version Information:

Microsoft Visual Studio Professional 2015
Version 14.0.25123.00 Update 2
Microsoft .NET Framework
Version 4.6.01038

Installed Version: Professional

Xamarin (0dd817c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (a94a03b)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (3a25bf1)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Jonathan Pryor 2016-04-06 01:20:48 UTC
It looks like this was fixed in monodroid/bbf82a02 (January 2016) but was never cherry-picked to Cycle6.

This should be fixed in Cycle7.