Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - DataContractSerializer exception "System.DelegateSerializationHolder+DelegateEntry[...] not expected"

 
 
Old 07-31-2006   #1 (permalink)
Fabian


 
 

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

My System SpecsSystem Spec
Old 08-01-2006   #2 (permalink)
Arkady Frenkel


 
 

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



My System SpecsSystem Spec
Old 08-01-2006   #3 (permalink)
Fabian


 
 

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

>
>

My System SpecsSystem Spec
Old 08-02-2006   #4 (permalink)
Arkady Frenkel


 
 

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

>>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Exception calling "CreateInstance" with "2" argument(s): for Microsoft.Update.UpdateColl PowerShell
Exception calling "Send" with "1" argument(s) error using PING PowerShell
Error: "Cannot convert "System.Object[]" to "System.Int32"." PowerShell
What happened with the two "Vista Performance Patches" expected for yesterday? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46