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.
Created attachment 10970 [details]
Custom [Preserve] attribute only works under the Android.Runtime namespace on Android
This is the same issue as bug 28389, but now reported against Android rather than iOS (and with a simplified test case).
## Steps to reproduce
Build and run the "AndroidApp1" project from attached test case in the "Debug|Any CPU" configuration (on an x86 or armeabi-v7a device or emulator).
The linker set to "Link all" for all of the build configurations in the test case.
The app hits an exception because the method "MyClass.Foo()" has been linked away.
## Expected results
Thanks to the fix for bug 29389, the corresponding iOS test case "UnifiedSingleViewIphone1" launches and runs with _no_ exceptions.
## Partial workaround
Change the namespace of `PortableLibrary1.PreserveAttribute` to `Android.Runtime`, so the fully qualified type name will be: `Android.Runtime.PreserveAttribute`.
## Version info
Xamarin Android Player 0.3.7 (1), Nexus 4 (KitKat)
### OS X 10.9.5, MacBook Air
Mono 4.0.0 (detached/d136b79)
=== Xamarin.Android ===
Version: 220.127.116.11 (Business Edition)
Android SDK: /Users/macuser/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.3 (API level 10)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: /Users/macuser
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
The partial workaround doesn't appear to work for us within our solution. However the partial workaround does work when i download and run the attached sample. So I am highly confused. There must be some difference between the sample, and our solution, that means the partial workaround works in one scenario and not the other, but I cannot figure out what that difference is :(
This is now fixed in master by aefb60900ca11e2045e0fde049e254af146c160a
I am able to reproduce the exception with Stable build of C5SR2 XA 18.104.22.168 and observed that this issue is fixed in C5SR3 XA i.e. mono-android-5.1.4-30.
Hence closing this issue.