Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

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

 
 
Thread Tools Display Modes
Old 07-31-2006   #1 (permalink)
Fabian
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
Old 08-01-2006   #2 (permalink)
Arkady Frenkel
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



Old 08-01-2006   #3 (permalink)
Fabian
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

>
>

Old 08-02-2006   #4 (permalink)
Arkady Frenkel
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








Vistax64.com 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 2005-2008

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 47 48 49 50