![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | DataContractSerializer "Expecting element" problem Hello ! I have just passed to the RTM version of winfx and I don't understand why the DataContractSerializer doesn't work any more. I want to serialize an object with a xml stream which no contain all the properties of the object. With the winfx beta 2, it work fine, but now I optain the error : "Error in line 3 position 4. 'Element' 'CommonName' from namespace 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting element '_includedProperties'." I tried to use serializer like this : DataContractSerializer __serializer = new DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true, null); On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can read : "parameters to ignore unexpected data" but it seem not work ... I tried to motify the DataMember to "NotRequired" like this : [DataMember(IsRequired=false)] private IList<string> _includedProperties = new List<string>(); But no changes ... Can somebody help me ? thanks Xeron |
My System Specs![]() |
| | #2 (permalink) |
| | Re: DataContractSerializer "Expecting element" problem Ask additionally that on http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1 Arkady "Xeron" <Xeron@discussions.microsoft.com> wrote in message news:55FDE637-ED15-42FC-8545-EB17A9268902@microsoft.com... > Hello ! > > I have just passed to the RTM version of winfx and I don't understand why > the DataContractSerializer doesn't work any more. > > I want to serialize an object with a xml stream which no contain all the > properties of the object. With the winfx beta 2, it work fine, but now I > optain the error : > > "Error in line 3 position 4. 'Element' 'CommonName' from namespace > 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting > element '_includedProperties'." > > I tried to use serializer like this : > > DataContractSerializer __serializer = new > DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true, > null); > > On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can > read > : "parameters to ignore unexpected data" but it seem not work ... > > I tried to motify the DataMember to "NotRequired" like this : > > [DataMember(IsRequired=false)] > private IList<string> _includedProperties = new List<string>(); > > But no changes ... > > Can somebody help me ? thanks > Xeron |
My System Specs![]() |
| | #3 (permalink) |
| | Re: DataContractSerializer "Expecting element" problem Done, thx "Arkady Frenkel" wrote: > Ask additionally that on > http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1 > Arkady > > "Xeron" <Xeron@discussions.microsoft.com> wrote in message > news:55FDE637-ED15-42FC-8545-EB17A9268902@microsoft.com... > > Hello ! > > > > I have just passed to the RTM version of winfx and I don't understand why > > the DataContractSerializer doesn't work any more. > > > > I want to serialize an object with a xml stream which no contain all the > > properties of the object. With the winfx beta 2, it work fine, but now I > > optain the error : > > > > "Error in line 3 position 4. 'Element' 'CommonName' from namespace > > 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting > > element '_includedProperties'." > > > > I tried to use serializer like this : > > > > DataContractSerializer __serializer = new > > DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true, > > null); > > > > On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can > > read > > : "parameters to ignore unexpected data" but it seem not work ... > > > > I tried to motify the DataMember to "NotRequired" like this : > > > > [DataMember(IsRequired=false)] > > private IList<string> _includedProperties = new List<string>(); > > > > But no changes ... > > > > Can somebody help me ? thanks > > Xeron > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: DataContractSerializer "Expecting element" problem Done, thx "Arkady Frenkel" wrote: > Ask additionally that on > http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1 > Arkady |
My System Specs![]() |
| | #5 (permalink) |
| | RE: DataContractSerializer "Expecting element" problem Hi Xeron, Can you share a repro so we can look into it further? Thanks, Sara "Xeron" wrote: > Hello ! > > I have just passed to the RTM version of winfx and I don't understand why > the DataContractSerializer doesn't work any more. > > I want to serialize an object with a xml stream which no contain all the > properties of the object. With the winfx beta 2, it work fine, but now I > optain the error : > > "Error in line 3 position 4. 'Element' 'CommonName' from namespace > 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting > element '_includedProperties'." > > I tried to use serializer like this : > > DataContractSerializer __serializer = new > DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true, > null); > > On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can read > : "parameters to ignore unexpected data" but it seem not work ... > > I tried to motify the DataMember to "NotRequired" like this : > > [DataMember(IsRequired=false)] > private IList<string> _includedProperties = new List<string>(); > > But no changes ... > > Can somebody help me ? thanks > Xeron |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Anno 1404 "save/load" problem and using "runas.exe" | Gaming | |||
| New Problem - "From" Address format in "Microsoft Communities" | Live Mail | |||