error CS0200: Property or indexer 'LinqEntityBaseLoan.LINQEntityBase.LINQEntityGUID' cannot be assigned ...

Feb 26, 2009 at 10:12 AM
Edited Feb 26, 2009 at 10:34 AM
Hi,

Today with a new update to the .net framework (vista x64 french (+en/nl)), a new error :
error CS0200: Property or indexer 'LinqEntityBaseLoan.LINQEntityBase.LINQEntityGUID' cannot be assigned to -- it is read only
error CS0200: Property or indexer 'LinqEntityBaseLoan.LINQEntityBase.MMPrimaryKey' cannot be assigned to -- it is read only
with the "standard" XmlSerializer.

It is "normal" because "private set modifier" but this brokes existing code and because the XML generated by the two serializer are different (?), to keep code, i need to remove the private modifier.

But probably a bug in .net ? Because these element are not serialised in the XML.
Coordinator
Feb 27, 2009 at 8:57 PM
Edited Feb 27, 2009 at 10:31 PM
Hi there,

seems like other people have this issue, xmlserializer doesn't seem to like private setters at all - yes it's a bug in .NET


You have three choices:

1. Remove the private setters on these items in the LINQEntityBase
2. Use the Data Contact Serializer instead (there's a couple of static methods to serialize/deserialize on the LINQEntityBase)
3. Override the default XMLSerializer behaviour to get it's XML from the DataContract Serializer instead ( I haven't done this, but from memory I think it can be done).

Is there any reason it has to be XMLSerializer?

Cheers

Matt.