Change the name of duplicated events in #region "Event implementation for <interface>" for Xamarin Android Binding library

Viewed 84

I'm attempting to create a Xamarin Binding Library for the Android UseButton library. I created my binding project, included the .aar and set Build Action = LibraryProjectZip. As was expected, a bunch of errors popped up and I've managed to get rid of most using the Metadata.xml file, except for a bunch that follow the same pattern:

Error CS0102 The type 'CrossBridgeCommunicator' already contains a definition for 'WebViewDismiss'

I checked the CrossBridgeCommunicator class, and found it has 2 copies of about 12 events. Here's a snippet of one of these duplicates

#region "Event implementation for Com.Usebutton.Sdk.Internal.Bridge.BridgeMessageParser.IListener"
...
public event EventHandler WebViewDismiss {
    add {
        global::Java.Interop.EventHelper.AddEventHandler<global::Com.Usebutton.Sdk.Internal.Bridge.BridgeMessageParser.IListener, global::Com.Usebutton.Sdk.Internal.Bridge.BridgeMessageParser.IListenerImplementor>(
        ref weak_implementor___SetMainBridge,
        __CreateIListenerImplementor,
        __v => MainBridge = __v,
        __h => __h.OnWebViewDismissHandler += value);
    }
...
}
...
public event EventHandler WebViewDismiss {
    add {
        global::Java.Interop.EventHelper.AddEventHandler<global::Com.Usebutton.Sdk.Internal.Bridge.BridgeMessageParser.IListener, global::Com.Usebutton.Sdk.Internal.Bridge.BridgeMessageParser.IListenerImplementor>(
        ref weak_implementor___SetWidgetBridge,
        __CreateIListenerImplementor,
        __v => WidgetBridge = __v,
        __h => __h.OnWebViewDismissHandler += value);
    }
...
}

The only difference between them is that they access different attributes in their bodies (the "weak_implementor__"). I checked the original class in a Java decompiler and it doesn't implement any of these events; in fact, it doesn't even implement the interface. What it does have are 2 fields of this interface type. I'm guessing Xamarin creates these methods for some reason, but I don't know why or how. They don't even appear on the api.xml (nor do the fields).

I tried to change the name of the events using the Metadata.xml file, but, since these events don't even exist in the Java class, I don't know how to find them. I even tried to remove the fields using "remove-node", but am getting the warning no nodes matched. Does anyone know how can I change these events' names? Again, they come from the same interface, but are created directly on the class that has 2 fields of the interface type.

Thanks in advance.

0 Answers
Related