Bug 55756 - Link sdk only links entire app
Summary: Link sdk only links entire app
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.3 (15.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-04-29 05:08 UTC by Jim Bennett
Modified: 2017-06-19 19:56 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Reproduction project (301.65 KB, application/zip)
2017-04-29 05:08 UTC, Jim Bennett
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED ANSWERED

Description Jim Bennett 2017-04-29 05:08:03 UTC
Created attachment 21898 [details]
Reproduction project

I have an MvvmCross app, with two properties that are only used by a MvxBind attribute in an AXML file. If I compile my app with link SDK assemblies only these properties are removed, I have to add a [Preserve] attribute to them to make my app work.

The attached project shows this - if you run the Android app in Release, tap the + button, enter a name and tap done you won't see the named counter and it's count in the list, just a plus button. If you then add a [Preserve] attribute to the CounterViewModel class and try again the values appear.
Comment 1 Jon Douglas [MSFT] 2017-06-19 19:56:47 UTC
(In reply to Jim Bennett from comment #0)
> Created attachment 21898 [details]
> Reproduction project
> 
> I have an MvvmCross app, with two properties that are only used by a MvxBind
> attribute in an AXML file. If I compile my app with link SDK assemblies only
> these properties are removed, I have to add a [Preserve] attribute to them
> to make my app work.
> 
> The attached project shows this - if you run the Android app in Release, tap
> the + button, enter a name and tap done you won't see the named counter and
> it's count in the list, just a plus button. If you then add a [Preserve]
> attribute to the CounterViewModel class and try again the values appear.

Yes the Linker is stripping these items, but I believe it's on the MvvmCross side of things.

Can you double check and make sure that you have updated to the latest LinkerPleaseInclude.cs that MvvmCross provides? For example, yours is missing a few elements that seems to fix this.

For example, I can reproduce your same issue if running a "Release" application from your .zip. 

However if I add the latest LinkerPleaseInclude.cs changes from:

https://github.com/MvvmCross/MvvmCross/blob/2a1c4fb41aa228946a25f68c35d786f9845e8404/nuspec/DroidContent/LinkerPleaseInclude.cs.pp

Then it works just fine. Here's a gist with the differences:

https://gist.github.com/JonDouglas/95634b9e8e6e02879470852c34a51857