Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
The Android Spannable interface includes several very important constants which are used to define the styling behavior of SpannableStrings. The Android documentation details these constants:
I believe these should be added to the ISpannable interface to match Android functionality?
This is unfortunately By Design.
The way binding works is we take a .jar (e.g. android.jar), generate an API description via jar2xml, then generate C# source from the API description, then compile the C# source into the binding assembly.
All of the glue code is thus represented in C#, and thus must be valid C#.
Unfortunately, C#'s definition of what's valid within an interface doesn't match Java's: C# interfaces can only contain method, property, and event declarations. No fields, no constants, no nested types, no static methods, etc.
Consequently, the C# ISpannable binding CANNOT contain an ISpannable.SpanExclusiveExclusive member, not without changing the language. (IL should allow this, but who wants to hand-write IL?)
Instead, one of two things is done:
1. The interface constants are mapped to enumerations.
In the case of android.text.Spannable, the constants are present on the SpanTypes enum: http://androidapi.xamarin.com/?link=T%3aAndroid.Text.SpanTypes
2. When the interface constants don't map to an enumeration
In this case, e.g. the android.os.Parcelable interface, the interface methods are moved to a normal C# interface -- IParcelable -- while the interface constants are moved to a type with the same name as the Java interface, in this case Android.OS.Parcelable.
For the same 'C# is our glue" reason, nested types such as android.os.Parcelable.Creator are not nested types, and android.os.Parcelable.Creator is bound as IParcelableCreator: http://androidapi.xamarin.com/?link=T%3aAndroid.OS.IParcelableCreator