Reputation: 43
I'm using protobuf-net
in WP7 to serialize my data.
I initialize my custom types at launch of app, but I have a big problem:
If I launch my app in the background (tombstoning) for a few minutes, when the app then becomes active an exception is thrown as I haven't initialised the types.
Does anyone have a solution to this problem? Thank you!
SOLUTION:
I resolved the problem like this:
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
// add types
// RuntimeTypeModel.Default.Add(......);
}
}
Upvotes: 1
Views: 146
Reputation: 43
I resolved the problem like this:
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (!e.IsApplicationInstancePreserved)
{
// add types
RuntimeTypeModel.Default.Add(...);
}
}
Upvotes: 2