Problem with open MVVMLight ViewModelBase open constructor without parameters in an inherited base class for WP7 Tombstoning

I am accessing the tomb in Wp7, resetting my ViewModel to PhoneApplicationService (see link for more information ).

My ViewModel (VM) is inherited from the MVVM Light Toolkit (ViewModelBase), which has only a protected constructor without parameters.

This causes serialization to fail:

"The type 'GalaSoft.MvvmLight.ViewModelBase' cannot be deserialized in partial trust because it does not have a public parameterless constructor."

Excuse my ignorance, but serialization is new to me - I think I understand why this is not working out, but I'm trying to think about it. For example, can I mark the entire base class as unserializable or ignored, as I do certain fields in classes ([IgnoreDataMember])? I do not need to store anything in this class.

Anyway, around? I do not want to edit the source of this assembly to make it public, not protected.

+3
source share
1 answer

StyleCop, ViewModelBase. , , , . WP7, vm .

, , viewmodelbase. .

Cheers, Laurent

+4

Source: https://habr.com/ru/post/1770470/


All Articles