![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | DataContractSerializer exception "System.DelegateSerializationHolder+DelegateEntry[...] not expected" Hello, I have an object tree which I want to serialize to disk using the DataContractSerializer. For complexity reasons I have not defined specific data contracts for each class but I have marked them [Serializable]. Now I am getting the following exception: Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer. I don't know what to add to the KnownTypes list... Any idea? thx in advance Fabian |
| | #2 (permalink) |
| Guest | Re: DataContractSerializer exception "System.DelegateSerializationHolder+DelegateEntry [...] not expected" AFAIK DataContractSerializer serialize Classes defined with DataContract and if no such XMLSerializer class need be used Arkady "Fabian" <neutronstorm@newsgroups.nospam> wrote in message news:uZdoT6JtGHA.4600@TK2MSFTNGP06.phx.gbl... > Hello, > > I have an object tree which I want to serialize to disk using the > DataContractSerializer. For complexity reasons I have not defined specific > data contracts for each class but I have marked them [Serializable]. > > Now I am getting the following exception: > > Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract > name > 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' > is not expected. Add any types not known statically to the list of known > types - for example, by using the KnownTypeAttribute attribute or by > adding them to the list of known types passed to DataContractSerializer. > > I don't know what to add to the KnownTypes list... > > Any idea? > > thx in advance > > Fabian |
| | #3 (permalink) |
| Guest | Re: DataContractSerializer exception "System.DelegateSerializationHolder+DelegateEntry[...] not expected" Hi Arkandy, thanks for your answer. According to http://msdn.microsoft.com/msdnmag/is...n/default.aspx DataContractSerializer can handle both DataContract and [Serializable] marked classes. I have test program where this works perfectly with single classes. The problem with the XMLSerializer is that when it deserialializes, it calls a parameterless default constructor and sets the saved values via set properties. But I do not want to expose all my values via set properties. So the question is, why does it work on single classes but not on a three of objects? Thx a lot, Fabian Arkady Frenkel schrieb: > AFAIK DataContractSerializer serialize Classes defined with DataContract and > if no such XMLSerializer class need be used > Arkady > > "Fabian" <neutronstorm@newsgroups.nospam> wrote in message > news:uZdoT6JtGHA.4600@TK2MSFTNGP06.phx.gbl... >> Hello, >> >> I have an object tree which I want to serialize to disk using the >> DataContractSerializer. For complexity reasons I have not defined specific >> data contracts for each class but I have marked them [Serializable]. >> >> Now I am getting the following exception: >> >> Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract >> name >> 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' >> is not expected. Add any types not known statically to the list of known >> types - for example, by using the KnownTypeAttribute attribute or by >> adding them to the list of known types passed to DataContractSerializer. >> >> I don't know what to add to the KnownTypes list... >> >> Any idea? >> >> thx in advance >> >> Fabian > > |
| | #4 (permalink) |
| Guest | Re: DataContractSerializer exception "System.DelegateSerializationHolder+DelegateEntry [...] not expected" That IMHO because DataContractSerializer born to serialize parameter(s) of the service method ( function ) which usually value of predefined type of ..Net or some class ( or derived from that class, so KnownType used to describe it ). Interesting to check if SOAP allow such serialization of single parameter to the function by definition at all. BTW ask additionally that on WCF forum http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1 and post here the answer if you'll find it. TIA Arkady "Fabian" <neutronstorm@newsgroups.nospam> wrote in message news:ud0O00UtGHA.644@TK2MSFTNGP03.phx.gbl... > Hi Arkandy, > > thanks for your answer. According to > http://msdn.microsoft.com/msdnmag/is...n/default.aspx > DataContractSerializer can handle both DataContract and [Serializable] > marked classes. I have test program where this works perfectly with single > classes. The problem with the XMLSerializer is that when it > deserialializes, it calls a parameterless default constructor and sets the > saved values via set properties. But I do not want to expose all my values > via set properties. > So the question is, why does it work on single classes but not on a three > of objects? > > Thx a lot, > > Fabian > > > Arkady Frenkel schrieb: >> AFAIK DataContractSerializer serialize Classes defined with DataContract >> and if no such XMLSerializer class need be used >> Arkady >> >> "Fabian" <neutronstorm@newsgroups.nospam> wrote in message >> news:uZdoT6JtGHA.4600@TK2MSFTNGP06.phx.gbl... >>> Hello, >>> >>> I have an object tree which I want to serialize to disk using the >>> DataContractSerializer. For complexity reasons I have not defined >>> specific data contracts for each class but I have marked them >>> [Serializable]. >>> >>> Now I am getting the following exception: >>> >>> Type 'System.DelegateSerializationHolder+DelegateEntry' with data >>> contract name >>> 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' >>> is not expected. Add any types not known statically to the list of known >>> types - for example, by using the KnownTypeAttribute attribute or by >>> adding them to the list of known types passed to DataContractSerializer. >>> >>> I don't know what to add to the KnownTypes list... >>> >>> Any idea? >>> >>> thx in advance >>> >>> Fabian >> |
| |
| |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exception calling "Send" with "1" argument(s) error using PING | bass_player | PowerShell | 4 | 07-08-2008 10:32 PM |
| Error: "Cannot convert "System.Object[]" to "System.Int32"." | Shay Levi | PowerShell | 3 | 01-31-2008 04:16 AM |
| What happened with the two "Vista Performance Patches" expected for yesterday? | Juan I. Cahis | Vista General | 10 | 08-16-2007 12:59 AM |
| "File and Printer sharing" firewall exception scope in Vista ? | Vilius | Vista networking & sharing | 0 | 07-16-2007 04:44 PM |