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 for Bug 56207 on
Developer Community or GitHub if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 22074 [details]
Point and Size types from XML files will not deserialize successfully when Linking is set to "SDK Assemblies Only". When the Linker is set to "SDK Assemblies Only" Mono.Android is linked out (reducing the overall output size) however causing the application to crash with an error:
java.lang.IllegalArgumentException: width and height must be > 0
Disabling the linker will resolve this issue, however the application size climbs up to ~30mb compared to ~7mb when the linker is enabled.
The application will build and run successfully when the Linker is set to Link SDK Assemblies and successfully reserialize the XML file containing the System.Drawing.Size Size value and a System.Drawing.Point Location value.
The application will build successfully however will crash when running on either a Android emulator of physical device with the following error message:
> Unhandled Exception:
> Java.Lang.Exception: width and height must be > 0
> --- End of managed Java.Lang.Exception stack trace ---
> java.lang.IllegalArgumentException: width and height must be > 0
> at android.graphics.Bitmap.createBitmap(Bitmap.java:829)
> at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
> at android.graphics.Bitmap.createBitmap(Bitmap.java:739)
> at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:615)
> at md589b15ac596100f9bed06834473022d52.MainActivity.n_onCreate(Native Method)
> at md589b15ac596100f9bed06834473022d52.MainActivity.onCreate(MainActivity.java:29)
> at android.app.Activity.performCreate(Activity.java:6237)
> at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
> at android.app.ActivityThread.-wrap11(ActivityThread.java)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
> at android.os.Handler.dispatchMessage(Handler.java:102)
> at android.os.Looper.loop(Looper.java:148)
> at android.app.ActivityThread.main(ActivityThread.java:5417)
> at java.lang.reflect.Method.invoke(Native Method)
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
##Steps to replicate
1). Download attached solution
2). Set linker to "None" -> Build solution
3). Deploy to Android device / emulator
Notice how the Xamarin logo and text appears successfully on the screen
4). Stop debugging then set the Linker Setting to "Link SDK Assemblies Only"
5). Rebuild solution -> deploy
Observed is the crash once the app tries to display that same screen.
Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Installed Version: Enterprise
Xamarin 188.8.131.523 (c871575)
Xamarin.Android 184.108.40.206 (448f54f)
I've attempted to use Custom Linker settings to skip linking various namespaces from within the Mono.Android assembly however none seemed to have worked.
and more that I can't remember at the moment since I've tried a lot of namespaces to skip in the custom linker xml file added to the project.
Additionally, there is a discussion about this very same issue at the following Stackoverflow post:
Setting to confirmed as I and the user who submitted issue on Stackoverflow were able to successfully replicate.