Bug with PropertyChangedBase.OnDeserialized(), advice/review needed

Topics: Bugs, Framework Services
Aug 11, 2011 at 2:29 PM

Hi there

I've hit a strange bug and would like to ask advice if (andf how) Caliburn should takle it.

Intro: Caliburn.Micro, Silverlight 4 target, OOB app.

How to reproduce:

  • create a class that derives from PropertyChangedBase
  • save an instance of that class to Isolated Storage (IsolatedStorageSettings.ApplicationSettings)
  • close application
  • run application again

Expected result - IsolatedStorageSettings.ApplicationSettings should contain a value.

Actual result - IsolatedStorageSettings.ApplicationSettings is empty. Even if you had other stored values, settings are loaded empty. There is nothing signaling for troubles, no exceptions.

I've found that there is a piece of code that prevents loading ApplicationSettings normally. Here it is:

        void OnDeserialized(StreamingContext c) {
            IsNotifying = true;

When this code is commented/removed the ApplicationSettings are loaded normally.

A workaround is to implement INPC manually, then everything works.

What are your toughts on this?

Aug 11, 2011 at 2:46 PM
Edited Aug 11, 2011 at 3:09 PM

I'm preparing a sample project demonstrating this behavior.


Done. Clone URL: https://hg01.codeplex.com/forks/vcaraulean/applicationsettingsbug 

Aug 11, 2011 at 3:12 PM

On of workarounds will be to surround it with #if !SILVERLIGHT, but I'm not sure this will break other parts that rely on it.

Also to note that BindableCollection<T> may suffer from same problem.

Aug 11, 2011 at 3:47 PM

I can easily add those conditionals. I don't think it will break anything else. If you would create a ticket for this issue and link to this discussion that will help remind me to get it fixed. Thanks!

Aug 11, 2011 at 3:56 PM

Done, http://caliburnmicro.codeplex.com/workitem/146.