monoxamarin.androidbugsense

Rename "params" parameter in Java Bindings Library with Mono for Android?


I'm trying to create a Java Binding Library for BugSense, but one of the methods has a parameter named "params" which is a reserved word in C#. I've tried to use the Metadata.xml file to rename it, but I can't figure out how to access the class, let alone the method or it's parameter.

Here is the problem code it's generating:

namespace Com.Bugsense.Trace {

[global::Android.Runtime.Register ("com/bugsense/trace/ActivityAsyncTask", DoNotGenerateAcw=true)]
internal partial class ActivityAsyncTaskInvoker : ActivityAsyncTask {

    static IntPtr id_doInBackground_arrayLjava_lang_Object_;
    [Register ("doInBackground", "([Ljava/lang/Object;)Ljava/lang/Object;", "GetDoInBackground_arrayLjava_lang_Object_Handler")]
    protected override global::Java.Lang.Object DoInBackground (global::Java.Lang.Object[] params)
    {
        if (id_doInBackground_arrayLjava_lang_Object_ == IntPtr.Zero)
            id_doInBackground_arrayLjava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "doInBackground", "([Ljava/lang/Object;)Ljava/lang/Object;");
        IntPtr native_params = JNIEnv.NewArray (params);
        global::Java.Lang.Object __ret = Java.Lang.Object.GetObject<global::Java.Lang.Object> (JNIEnv.CallObjectMethod  (Handle, id_doInBackground_arrayLjava_lang_Object_, new JValue (native_params)), JniHandleOwnership.TransferLocalRef);
        if (params != null) {
            JNIEnv.CopyArray (native_params, params);
            JNIEnv.DeleteLocalRef (native_params);
        }
        return __ret;
    }
}
}

Here is my mapping, which I feel should work, but just refuses to.

<attr path="/api/package[@name='com.bugsense.trace']/class[@name='ActivityAsyncTaskInvoker']/method[@name='doInBackground']/parameter[@name='params']" name="managedName">@params</attr>

I've tried everything I can think of. Please, HELP!


Solution

  • So, turns out it's just a bug in the current version of Mono for Android. If you update to the 4.2.4 build, which is in beta, everything compiles fine.