Bug 36697 - Xamarin.Forms.Application.Current.Properties can't be persistent if the Linker mode is "Link SDK assemblies only"
Summary: Xamarin.Forms.Application.Current.Properties can't be persistent if the Linke...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 7.1 (C9)
Assignee: Radek Doulik
: 36771 ()
Depends on:
Reported: 2015-12-08 00:27 UTC by Hao
Modified: 2017-10-13 16:48 UTC (History)
13 users (show)

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

The page to demonstrate the bug (981 bytes, application/octet-stream)
2015-12-08 00:27 UTC, Hao
Demo solution (329.91 KB, application/zip)
2016-08-04 07:28 UTC, mario.rasch.ext
link description file (168 bytes, text/xml)
2016-08-09 18:40 UTC, Radek Doulik

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:

Description Hao 2015-12-08 00:27:46 UTC
Created attachment 14172 [details]
The page to demonstrate the bug

Platform: Android
Test Device: Nexus 6
OS version: Android 6.0

If you set the project Linker's link behaviour to "Link SDK assemblies only" or "Link all" (basically that means if you use the linker), the data in Xamarin.Forms.Application.Current.Properties can't be persistent to disk.

I uploaded the testing code as attachment.

Steps to reproduce:
1. Build the app, make sure the Linker behaviour is "Link SDK assemblies only"
2. Start the app, then click button.
3. Force quite the app
4. Start the app again, you will see the data has not been saved successfully.
Comment 1 E.Z. Hart [MSFT] 2016-02-08 18:50:43 UTC
See also: bug 36771
Comment 2 Jason Smith [MSFT] 2016-04-13 20:10:40 UTC
Seems to be an issue with the linker
Comment 3 Jason Smith [MSFT] 2016-04-13 20:11:17 UTC
*** Bug 36771 has been marked as a duplicate of this bug. ***
Comment 4 Xin Meng 2016-04-18 10:17:34 UTC
same issue, any update?
Comment 5 Steeve 2016-05-13 06:52:41 UTC
Same problem here.
Our customers complain about that :(
Comment 6 Steeve 2016-06-21 10:24:18 UTC
Any news about that ? I need it to be corrected please :/ Customers are still complaining about that !
Comment 7 mario.rasch.ext 2016-06-28 10:59:43 UTC
I can confirm that this bug is still present in Xamarin.Forms

I reported this bug on December 2015 and still it is not fixed after more than 6 months!

BTW, that same problem I still have with quite a bunch of bugs (including demo solutions) that I reported to Xamarin. You just get a "thanks for reporting that bug" - but nether a fix...
Comment 8 Radek Doulik 2016-08-03 21:41:14 UTC
I am sorry, it slipped under my radar.

Could you please attach whole project, which reproduces this bug?
Comment 9 mario.rasch.ext 2016-08-04 07:28:59 UTC
Created attachment 16890 [details]
Demo solution

Steps to reproduce using this demo solution:

1. Build the app in Release configuration (= linker property "Linking" is set to "Sdk Assemblies Only")
2. Start the app and change the URL
3. Force quite the app
4. Start the app again and you will see your changes to the URL have not been persisted
Comment 10 Radek Doulik 2016-08-09 18:39:38 UTC
Thanks for the info. I was able to replicate it. I can give you workaround, before the bug is fixed.

You can either add System.Runtime.Serialization assembly to list of ignored assemblies by linker, or add attached file to your project and set build action to LinkDescription.
Comment 11 Radek Doulik 2016-08-09 18:40:14 UTC
Created attachment 16959 [details]
link description file
Comment 12 mario.rasch.ext 2016-08-17 13:11:04 UTC
Thnaks Radek! I tried your workaround using the link description file and it works for me.
Comment 13 Radek Doulik 2016-10-07 14:26:32 UTC
This should be now fixed in master and C9 by ae7d535efa3749ddf2f8e47b2f08f56f1d87e166
Comment 14 Mohit Kheterpal 2016-10-10 14:39:31 UTC
I can reproduce this issue with the steps given in comment 9, with latest

C9 = xamarin.android-7.0.99-121_cf2beeaf61722a06763b2935ca84a81365c8e6b7 
Master = xamarin.android-7.0.99-121_cf2beeaf61722a06763b2935ca84a81365c8e6b7

This issue still exist i.e. changes in url does not appear even we clean and rebuild app again and then deploy it on device. And changes appear when we uninstall app from device and then re-deploy it.

As of now, I am reopening this issue.
Comment 15 Radek Doulik 2016-10-20 15:23:27 UTC
I have retested with current master and it works OK for me. Could you please retest it with current master?
Comment 17 Ant Klad 2017-02-08 21:58:36 UTC
This bug stil exists on Xamarin for Visual Studio.

Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Community

Visual Basic 2015   00322-20000-00000-AA797
Microsoft Visual Basic 2015

Visual C# 2015   00322-20000-00000-AA797
Microsoft Visual C# 2015

Visual C++ 2015   00322-20000-00000-AA797
Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package   7.17.00119.9
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
ASP.NET and Web Tools 2015.1 (Beta8)

ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
For additional information, visit http://www.asp.net/

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

Microsoft Azure Mobile Services Tools   1.4
Microsoft Azure Mobile Services Tools

NuGet Package Manager   3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   14.0.60519.0
Microsoft SQL Server Data Tools

TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   14.0.25527.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin (00fa5cc)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (501e63c)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (7beaef4)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 18 Alessandro 2017-10-12 12:22:21 UTC
I have the same problem... Android 6...
There is an ETA to solve this problem?
Comment 19 Radek Doulik 2017-10-13 15:20:01 UTC
This was fixed long ago. Are you sure you use latest Xamarin.Android?
Comment 20 Alessandro 2017-10-13 15:22:18 UTC
=== Visual Studio Community 2017 for Mac ===

Version 7.1 (build 1297)
Installation UUID: e9c85728-289a-4de3-8442-d551ea358311
	Mono (d15-3/da80840) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 502000215

=== NuGet ===


=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
SDK: /usr/local/share/dotnet/sdk/1.0.3/Sdks
SDK Version: 1.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Versione: 1.5.5
Percorso: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.3 (12175.1)
Build 8E3004b

=== Xamarin.iOS ===

Version: (Visual Studio Community)
Hash: 80b8487d
Branch: d15-3
Build date: 2017-08-18 16:07:26-0400

=== Xamarin.Android ===

Versione: (Visual Studio Community)
Android SDK: /Users/alessandrocaliaro/Library/Developer/Xamarin/android-sdk-macosx
	Versione di Android supportate:
		6.0 (livello API 23)
		7.1 (livello API 25)

Versione degli strumenti SDK: 25.2.5
Versione degli strumenti della piattaforma SDK: 25.0.6
Versione degli strumenti di compilazione SDK: 25.0.3

Java SDK: /usr
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Il codice EPL di Android Designer è disponibile qui:

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Xamarin.Mac ===

Version: (Visual Studio Community)

=== Build Information ===

Release ID: 701001297
Git revision: 9c5299666538b2f8baf501418a5c064d784d64da
Build date: 2017-08-07 11:29:35-04
Xamarin addins: 3bb0c32a14f1b7e368bf5ac53a84c3581c019391
Build lane: monodevelop-lion-d15-3

=== Operating System ===

Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
    Thu Jun 15 17:36:27 PDT 2017
    root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Comment 21 Radek Doulik 2017-10-13 16:48:39 UTC
Please try to update. I see XA in the stable channel. If it doesn't help, attach a project which reproduces the issue and steps to reproduce it.