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.
Steps to reproduce:
1. Open the sample for ExportAttribute (https://github.com/xamarin/monodroid-samples/tree/master/ExportAttribute/ExportAttributeTest);
2. Open MainActivity.cs and change Activity1 to Activity1<T>;
3. Add a new class Activity2 : Activity<string> and move the attribute from Activity1<T> to Activity2, i.e.:
[Activity (Label = "ExportAttributeTest", MainLauncher = true)]
public class Activity2 : Activity1<string>
4. Start the sample.
It loads and works as before.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
> 0xE0 in System.Reflection.MonoMethod.Invoke at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:236 C#
0x6 in System.Reflection.MethodBase.Invoke at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:98 C#
0x7E in Android.Runtime.JNIEnv.CreateDynamicCallback at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:78 C#
0x1E1 in Android.Runtime.JNIEnv.RegisterJniNatives at /Users/builder/data/lanes/monodroid-mac-monodroid-4.4-series/6418373f/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:119 C#
Note: I'm not sure if this is a bug, or a limitation that cannot be overcome. I can easily work around it so I'm just letting you know.
Any comment on this bug?
This was a previously undocumented limitation: generic C# types cannot declare [Export] or [ExportField] methods, because the method may potentially be invoked from the Java-side, from which there is no known C#-side type information. (Rephrased, we'd be trying to lookup and invoke Activity<T>.MyButton_OnClick(), and there's no way of knowing what `T` should be at that point in time.)
This limitation is now documented at:
*** This bug has been marked as a duplicate of bug 10135 ***