Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bruno-garcia/xamarin-android-java-binding-repro
Repro for issue binding Android library with Xamarin
https://github.com/bruno-garcia/xamarin-android-java-binding-repro
android binding xamarin xamarin-android
Last synced: 23 days ago
JSON representation
Repro for issue binding Android library with Xamarin
- Host: GitHub
- URL: https://github.com/bruno-garcia/xamarin-android-java-binding-repro
- Owner: bruno-garcia
- Created: 2019-12-09T05:46:32.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T05:47:02.000Z (about 5 years ago)
- Last Synced: 2024-12-13T02:30:21.518Z (about 1 month ago)
- Topics: android, binding, xamarin, xamarin-android
- Language: C#
- Homepage:
- Size: 413 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Repro for binding Android library issue
![NotSupportedException](NotSupportedException.png "NotSupportedException")
The following Java code is not callable from C#:
```java
public static void doSomething(ConfigureOptions callback) {
Options o = new Options();
callback.configure(o);
}
public interface ConfigureOptions {
void configure(Options options);
}
}
```It is callable from Java (with 1.8 compat) as:
```java
public static void callDoSomething() {
doSomething(o -> Log.d(TAG, o.getValue()));
}
```The C# binding calling out the Java method without parameters works just fine.
Calling the one with while passing the argument, fails:```csharp
public class DotnetConfigureOptions :
Java.Lang.Object,
Com.Brunogarcia.Sample.IConfigureOptions
{
public void Dispose() { }
public IntPtr Handle { get; }
public void Configure(Com.Brunogarcia.Sample.Options options) =>
Log.Debug("dotnet", options.GetType().Name);
}Com.Brunogarcia.Sample.CallDoSomething();
// Throws here:
Com.Brunogarcia.Sample.DoSomething(new DotnetConfigureOptions());
```