Some deserialization oddities?

    General discussion

  • I fired up my first Windows 7 Phone app today, and generated a service ref to an existing WCF service, which works well with a Silverlight 3 app I wrote. Initially it just seemed to work, but then I noticed that reference types are not being deserialized. String and objects don't make it into the client side instances. Anyone seen anything like it? I use the same technique as in the SL 3 app, where I share types between the client and the middle tier, by creating a Phone app class library and linking in all the sources files of the business objects from the full .net fwk middle tier, then compile that and reference from the phone client. Again all the other fields work fine, just not reference types. Weird
    Wednesday, March 17, 2010 1:58 AM

All replies

  • I've done things that sounds similar and it should work just like in Silverlight 3. Could you try to see if this reproduces on a simple service that just passes a string around? Also, can you confirm (say, through fiddler) that the correct values are actually being passed around?


    Oren (MSFT)

    Wednesday, March 17, 2010 2:28 AM
  • OK, so I did a lot of digging, and these are my findings: A Generic List of instances of this class works fine: public class Simple { public int MyInt { get; set; } public double MyDouble { get; set; } public DateTime MyDateTime { get; set; } public string MyString1 { get; set; } public string MyString2 { get; set; } public Simple() { } } If I add in a base class, that Simple derives from, it still works: public class SimpleBase { public int BaseMyInt { get; set; } public double BaseMyDouble { get; set; } public DateTime BaseMyDateTime { get; set; } public string BaseMyString1 { get; set; } public string BaseMyString2 { get; set; } } However, if I add a third level parent, that SimpleBase inherits from: public class SimpleBaseBase { public int BaseBaseMyInt { get; set; } public double BaseBaseMyDouble { get; set; } public DateTime BaseBaseMyDateTime { get; set; } public string BaseBaseMyString1 { get; set; } public string BaseBaseMyString2 { get; set; } } Then the String members of Simple no longer serialize! So, three levels of inheritance, the granchild reference types do not deserialize! John
    Wednesday, March 17, 2010 1:19 PM
  • There are a lot of reflection items missing in the Windows Phone 7 SDK...I wonder if that is causing the problem.

    Wednesday, March 17, 2010 10:45 PM