Home » C# » Exception of type ‘Serialization.InvalidDataContractException’

Exception of type ‘Serialization.InvalidDataContractException’

windows-phone-logo50 During execution of your application, you receive following message:

A first chance exception of type ‘System.Runtime.Serialization.InvalidDataContractException’ occurred in System.Runtime.Serialization.ni.dll
An exception of type ‘System.Runtime.Serialization.InvalidDataContractException’ occurred in System.Runtime.Serialization.ni.dll and wasn’t handled before a managed/native boundary

In my application (for Windows Phone), I created a new class (c#) “TaskPlus.Models.Appoint” and this class was origine of this issue.

GregBlogSerialization

Detailed error message :

Type ‘TaskPlus.Models.Appoint’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor – all public members of the type will then be serialized, and no attributes will be required.

To solve problem, I created only “parameterless constructor”.

It was easy …;-(

 

About

Informatics - my job & my passion.