Search code examples
serializationwindows-phone-7datacontractserializersecurityexception

DataContract serialization throw an Security exception


I am trying to use DataContractSerialization on WPF and WP7. All things are good on WPF but not on WP7. When I tryed to serialize an object on wp7, I received an unknown security exception. Please view the attached source code and help me. Capture

Source code (mediafire)

Thanks.


Solution

  • I had the same issue.

    In my scenario, I was trying to serialize a nested class.

    I had to remove the nesting and define the class as public, and then it worked.