<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : InvalidDataContractException</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : InvalidDataContractException</description>
  <pubDate>Sun, 12 Apr 2026 23:42:15 -700</pubDate>
  <lastBuildDate>Thu, 08 Dec 2011 12:33:36 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3130</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>InvalidDataContractException :    When the metadata file is...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3130&amp;PID=12184#12184</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3130<br /><strong>Posted:</strong> 08-Dec-2011 at 12:33pm<br /><br />When the metadata file is loaded, we do deserialize its contents using the DataContractSerializer.&nbsp; We're passing to the serializer the full list of "known" types, the same list we'd pass when doing other serialization/deserialization, including moving data between the client and server.&nbsp; So, although it seems a bit odd since this type isn't part of the Code First model, you can think of it as the early warning, which would otherwise come later.<div></div><div>&nbsp;</div><div>Any known type must be serializable:&nbsp; this can mean marking it up with DataContract/DataMember attributes, or ensuring that it has a public constructor.</div><div>&nbsp;</div><div>It's possible that this type doesn't need to be included as a known type, though.&nbsp; Are you explicitly marking it as a known type?</div><div>&nbsp;</div><div>As for the ProvideEntityAspect attribute, it does not actually mark up the CF entity class with DataContract/DataMember attributes.&nbsp; The class must still be serializable, but these attributes aren't strictly required.&nbsp; </div><div>&nbsp;</div><div>You can find more information on known types and serialization here - <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/knowntypes" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/knowntypes</a>.</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Thu, 08 Dec 2011 12:33:36 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3130&amp;PID=12184#12184</guid>
  </item> 
  <item>
   <title>InvalidDataContractException :  I get the following exception...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3130&amp;PID=12175#12175</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=962" rel="nofollow">splace</a><br /><strong>Subject:</strong> 3130<br /><strong>Posted:</strong> 07-Dec-2011 at 11:26am<br /><br />I get the following exception during application start up.<div><br></div><div><i>Type 'DateRangeObject' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. &nbsp;If the type is a collection, consider marking it with the CollectionDataContractAttribute. &nbsp;See the Microsoft .NET Framework documentation for other supported types&nbsp;</i></div><div><br></div><div>This is&nbsp;occurring&nbsp;when trying to load the Metadata from the .ibmmx file. It is throwing the exception in a function called SerializationFns.RestoreDCS(...).</div><div><br></div><div>Do I have to annotate my classes with the &#091;DataContract&#093; attribute in Code First? I thought the &#091;ProvideEntityAspect&#093; generated the appropriate serialization code. Do you also have to annotate with the other attributes as well? &#091;Binding&#093; &#091;Display&#093; etc?</div><div><br></div><div>BTW it appears that DateRangeObject class is not the serialization file but is passed to the DataContract serializer as a KnownType.</div><div><br></div><div>Not sure if this helps but <i>DateRangeObject </i>is an abstract class.</div><div><br></div><div>Thanks for any help,</div><div>Sandy&nbsp;</div><span style="font-size:10px"><br /><br />Edited by splace - 07-Dec-2011 at 11:54am</span>]]>
   </description>
   <pubDate>Wed, 07 Dec 2011 11:26:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3130&amp;PID=12175#12175</guid>
  </item> 
 </channel>
</rss>