I've got some code for Windows Phone 7, for a RSS app:
private RSSSettings DeserializeSettings(string data)
{
RSSSettings rsssettings;
try
{
var ser = new DataContractSerializer(typeof(RSSSettings));
using (var sr = new StringReader(data))
using (var xr = XmlReader.Create(sr))
rsssettings = (RSSSettings)ser.ReadObject(xr);
}
catch (Exception ex)
{
ex.ToString();
rsssettings = new RSSSettings() { Version = -1 };
}
return rsssettings;
}
It works perfectly on Windows Phone 7. I ported the app to Windows Phone 8, and everything else in the app works except for this snippet.
Comparing what happens in Windows Phone 7 and 8, "rsssettings" in WP8 remains null while it populates correctly in WP7. There have been no code changes to this portion of the code at all.
Everything works the same until:
rsssettings = (RSSSettings)ser.ReadObject(xr);
The exception is not called.
Anyone have a clue as to how to resolve this frustrating issue?