I am working on porting a Java SDK to Xamarin.Android.
After solving numerous errors, I am stuck in this one:
/Users/alejandro_l/Projects/KontaktBeaconSDK/KontaktBeaconSDK/obj/Debug/generated/src/Com.Kontakt.Sdk.Android.Ble.Configuration.Scan.EddystoneScanContext.cs(65,65): Error CS1715:
Com.Kontakt.Sdk.Android.Ble.Configuration.Scan.EddystoneScanContext.EventTypes': type must be
System.Collections.Generic.ICollection' to match overridden member `Com.Kontakt.Sdk.Android.Ble.Configuration.Scan.AbstractProfileSpecificScanContext.EventTypes' (CS1715) (KontaktBeaconSDK)
For solving the error I though that it should be OK to use the following line in the metadata.xml telling the generator to change the type of the method to match with the abstract class:
<attr path="/api/package[@name='com.kontakt.sdk.android.ble.configuration.scan']/class[@name='EddystoneScanContext']/method[@name='getEventTypes' and count(parameter)=0]" name="managedType">System.Collections.Generic.ICollection</attr>
The generated output still has the wrong shape:
static IntPtr id_getEventTypes;
public override unsafe global::System.Collections.ICollection EventTypes {
// Metadata.xml XPath method reference: path="/api/package[@name='com.kontakt.sdk.android.ble.configuration.scan']/class[@name='EddystoneScanContext']/method[@name='getEventTypes' and count(parameter)=0]"
[Register ("getEventTypes", "()Ljava/util/Collection;", "GetGetEventTypesHandler")]
get {
if (id_getEventTypes == IntPtr.Zero)
id_getEventTypes = JNIEnv.GetMethodID (class_ref, "getEventTypes", "()Ljava/util/Collection;");
try {
return global::Android.Runtime.JavaCollection.FromJniHandle (JNIEnv.CallObjectMethod (Handle, id_getEventTypes), JniHandleOwnership.TransferLocalRef);
} finally {
}
}
}
As you can see System.Collections.ICollection is generated and not System.Collections.Generic.ICollection. Note: I even still did not figure it out how to also set the generic type, but that is the next step.
I am a newbie in binding and I cannot figure it out. Can someone tell me what I am doing wrong? Am I trying an impossible here? Do I need to change the source code of the SDK? (Notice that if I use "Build" and change manually the output I may get the dll in a future (still 49 errors left though) but I wonder if I can solve in a proper way).
Another useful link I used: https://gist.github.com/brendanzagaeski/9607158