Bug 26444 - Application.Current.Properties (persistent store) don't work on Android
Summary: Application.Current.Properties (persistent store) don't work on Android
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.2
Hardware: PC Windows
: Normal normal
Target Milestone: 1.4.0
Assignee: Bugzilla
Depends on:
Reported: 2015-01-27 03:42 UTC by Fredy Wenger
Modified: 2015-03-05 07:19 UTC (History)
7 users (show)

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

Details to bug (372.74 KB, application/pdf)
2015-01-27 03:42 UTC, Fredy Wenger

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 Fredy Wenger 2015-01-27 03:42:10 UTC
Created attachment 9510 [details]
Details to bug

Application.Current.Properties (persistent store) don't work on Android.
Strange behavior in Debugger ion iOS and Android (Unknow identifier: Application)
See .PDF in Attachment
Comment 1 Jason Smith [MSFT] 2015-01-27 03:55:41 UTC
The debugger issue is not related to Forms. You simply need to provide a fully qualified name (Xamarin.Forms.Application.Current).

A reproduction case would be handy, however I will certainly need info about your test device as it works fine on mine.
Comment 2 Fredy Wenger 2015-01-27 04:28:10 UTC
Debugger issue:
Why do I have to provide a fully qualified name in iOS and Android, while it works (is found) in WP?
If I change the code to Xamarin.Forms.Application.Current.xxxx, I have the same behavior with Xamarin instead Application: Unknow identifier: Xamarin
The device is a Samsung Tablet SM-T900.
If you want, I can submit my full project - let me know.
Comment 3 Fredy Wenger 2015-01-27 04:37:35 UTC
Debugger issue:
Why do I have to provide a fully qualified name in iOS and Android, while it works (is found) in WP?
If I change the code to Xamarin.Forms.Application.Current.xxxx, I have the same behavior with Xamarin instead Application: Unknow identifier: Xamarin
The device is a Samsung Tablet SM-T900.
If you want, I can submit my full project - let me know.
Comment 4 Fredy Wenger 2015-01-27 04:58:10 UTC
I have deployed the app also to a Chinese-Phone (Samsung GT-I9502 equivalent).
Same behavior in Debugger, "Unknow identifier" but, it seems to work.
So, it seems as the problem is related to the device "Samsung Tablet SM-T900)
Also the strange problem with the debugger remains (in iOS and Android).

I'm also not able to debug right now in iOS and Android (only platform that works, is WP).
See also http://forums.xamarin.com/discussion/comment/99519#Comment_99519

Maybe the problems (unknown identifier and debugger don't works) are related?
Comment 5 Jason Smith [MSFT] 2015-01-28 00:09:11 UTC
You will need to open a new bug against Xamarin.iOS and Xamarin.Android for your debugger related issue. However I suspect that they are not likely to go very far because the debugger work different depending if its using the Mono Soft Debugger or the Windows Debugger.

I am trying to get my hands on a SM-T900 for testing. Thank you for trying on a 2nd device and validating it works there. This is what we are seeing on our test devices.
Comment 6 Fredy Wenger 2015-01-28 03:43:47 UTC
O.K. I will fill new bugs.
Please have also a look at the bug  https://bugzilla.xamarin.com/show_bug.cgi?id=24614 (problem remove icons detail-page in master-detail-page in WP)
The bug is filled in since 2014-11-18 and still have the state "New".
Without a solution for this (silly) problem, I am not able to release my App for WP. 
I have spent day's now to search a solution and don't have received any help (not from Xamarin and also not in forum)
Comment 7 Seth Rosetter 2015-02-06 19:34:31 UTC

I have tested on a SM-T900 device using a sample I created with help from your attached PDF. I was unable to reproduce the issue. Application.Current.Properties worked as expected on my device.

I tested on a SM-T900 Samsung tablet, with Android 4.4.2. In order to help resolve your issue, could you send me small project with a reproduction case, or more information regarding your environment, (i.e. dependencies and their versions, as well as more device information)? 

Comment 8 Fredy Wenger 2015-02-09 03:42:51 UTC
Android-Device information's:
- Samsung M-T900
- Android-Version: 4.4.2
- Kernel-Version:
dpi@SWDD5022 #1
Mon Sept 1 09:57 44 KST 2014
Buildnumber: KOT 49H T900XXUANI1
SE for Android Status:
Wed Oct 15 11:33 18 2014
Let me know, If you need more information's.

Code-Example (called in constructor public App()-> also not works when called from OnStart():
if (!Application.Current.Properties.ContainsKey("iWebServerAuswahl")) 
  { Application.Current.Properties["iWebServerAuswahl"] = 0; } 
  GV.iServerWahl = Convert.ToInt32(Application.Current.Properties["iWebServerAuswahl"]); 

Behavior has to be:
First call of app:
- Key "iWebServerAuswahl" don't exist and is set to 0
Second call of app:
- Key "iWebServerAuswahl" exist and IS set to 0
Then set it to another value in app (e.g. 2)
Third call of app:
- Key "iWebServerAuswahl" exist and is (have to be) set to 2

This works on WP, iOS and also Android Phone, BUT NOT on SM-T900.
Please test an example with 1:1 this code.

If this helps, I can submit you my whole project...
Comment 9 Seth Rosetter 2015-02-09 15:37:37 UTC
Hi Fredy, 

I see your expected behavior is indeed how it should work. What is the outcome for you? After trying your example, the behavior is expected for me. 
If you could attach your whole project, it would be much appreciated. I will gladly take a look.
Comment 10 Fredy Wenger 2015-02-10 04:58:07 UTC
Hi Seth

I have sent you a mail with a (dropbox) download-link to my whole project.
The mail also contains a description, how to comprehend the problem.
This has cost me about 2 hours...

So.. please really look the app in deep.

Please send me a first feedback to the mail, after you were able to install the app.
Comment 11 Jason Smith [MSFT] 2015-03-03 02:33:18 UTC
Should be fixed in 1.4.0-pre1 via new API to allow user to manually sync out data.
Comment 12 Parmendra Kumar 2015-03-04 04:12:07 UTC
I have checked this issue with Xamarin.Forms version And I am getting same behavior mentioned in the attached .pdf file in bug description.

Screencast for the same:

Android Screencast: http://www.screencast.com/t/p6v5bDH8QWRy
Windows Screencast: http://www.screencast.com/t/g8UsikA1Os

Please let me know if I have missed anything to check this issue.

Environment info:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Xamarin   3.9.344.0 
Comment 13 Fredy Wenger 2015-03-04 09:49:29 UTC
I have updated now to 1.4.
It seems, as the store of the application.properties now (with the new save-method) also works on my Samsung SM-T900 tablet (it seems as the properties never were stored on it and that was the problem).

BUT I STILL HAVE THE PROBLEMS WITH "Unknown object Application" in the debuggers (iOS and Android).
And.. there are further horrible problems with the VS-debugger and iOS and Android (jus have a look at the Visual Studio Forum).
I'm not able to debug iOS (on iPhone) and Android without problems for over two month's now (and I am not the only one)!

If I have a look at your video, it seems, as you don't have tested it with MY Project (that I have sent you a while ago).
Further, I work with VS 2013 - Update 2 (where it seems as you have Update 4 installed).
I further have installed:

Xamarin   3.9.344.0 (same as you)
Xamarin.Android (same as you)
Xamarin.iOS (same as you)

So.. I propose, that you first test your small example on VS2013 - UPDATE 2.
If you then can't comprehend the problem with your small example
Run my already uploaded project

Give me then some feedback please...
Comment 14 Jason Smith [MSFT] 2015-03-05 06:20:46 UTC
The debugger issues are not relevant to this bug as originally reported and can not be tracked here. The remaining issues are resolved.

Parmendra the fix is a new API to allow developers to save their properties when updates occur. We can't change the fact that sometimes android kills the app before IO finishes. As such the reproduction case will continue to fail unless it is updated to use the save api.
Comment 15 Fredy Wenger 2015-03-05 07:19:55 UTC
Yes Jason, that's correct :-()

I have filled a bug to the Debugger (as you mentioned a while ago):
Status: (still) NEW
@Parmendra: I would be nice, if you would catch the other bug with the actual infomation's in my last message..