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.
From custom classes decorated with the DataContract attribute to simple strings, property values and keys fail to persist from one running of the application to the next. Demonstrated in office.
if( !Properties.ContainsKey( "testKey" ) )
Debug.WriteLine( "TestKey not found in properties; creating accordingly. || App.OnStart()" );
Properties.Add( TestKey, "Test key!!!" );
Will fire each successive execution of the application.
*** This bug has been marked as a duplicate of bug 31000 ***
This is NOT a duplicate of 31000 as it can be reproduced with a string value. This string value can not have a DataContract attribute associated with it.
Forgot to mention: this bug still evinces itself with an class instance decorated with a DataContract attribute and associated properties decorated with DataMember attributes.
Please create a buildable reproduction project. Thanks.
2. Set iOS as startup project.
3. Run once. Note debug output.
4. Stop debugging.
5. Run second time. Note debug output.
Repro steps provided above. Thanks.
Hey Ian, i m not able to reproduce the problem, i think you are not reading the code correctly .
To test using the Todo sample you should tap one of the items first, them you have to change the app to "Sleep" mode, you can tap the Android home button for example. You will see in the log:
setting ResumeAtTodoId = 7
OnSleep saving ResumeAtTodoId = 7
The properties is only saved when the app goes into to sleep mode, like for example when going to home or switching to another app:
Now if you do that, you can stop the app, run it again and you will see in the log:
Xamarin Forms Team
Thank you. I think I misunderstood - I thought that properties were meant to persist from one execution of the app to the next. Thank you for clarifying this, and my apologies for the confusion.
I re-read your post; tried the sample again and got the error to happen. Then I tried again and nothing. I have been trying for hours, cleaning my solution, cleaning the sample solution, and I have no idea why my project fails each time to persist the properties while the demo does not. I re-factored; duplicated the code in the sample in my own solution. Still it fails on my side but not in the sample.
My question is this: how can I debug what is going on behind the scenes? How can I dig deeper and find out what is going on?
can you email me your sample code?
Emailed you the code; spent another day testing. The behavior seems non-deterministic - or at least, I can't tell what is making it happen when. Did you get to check out what I sent you?