RE: SOAP serialization exception

From: Matt Tavis [MSFT] (mattavis_at_online.microsoft.com)
Date: 09/30/04


Date: Thu, 30 Sep 2004 17:30:22 GMT

Does the type mListColor represents still exist as well? If not, then that
could be your problem as well. If that isn't it then please send a more
complete stack trace and a repro if possible.

Thanks.

Matt Tavis

Program Manager
XML Web Services
Microsoft Corporation

--------------------
From: "Tim Anderson" <timjand@hotmail.com>
Subject: SOAP serialization exception
Date: Thu, 26 Aug 2004 15:38:17 +0100
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <OQkNVp3iEHA.396@TK2MSFTNGP12.phx.gbl>
Newsgroups:
microsoft.public.dotnet.framework.webservices,microsoft.public.dotnet.langua
ges.csharp
NNTP-Posting-Host: onlyconn.gotadsl.co.uk 82.133.123.179
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA02.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.languages.csharp:268249
microsoft.public.dotnet.framework.webservices:6370
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

I have an app that uses the SOAP serializer to serialize and deserialize a
object of a certain class to a file. The class implements ISerializable.
>From time to time it is necessary to add or remove fields from the class.
I've been able to deserialize out-of-date versions by handling serialization
exceptions in Sub New(ByVal info As SerializationInfo, ByVal context As
StreamingContext).

I've now hit a problem. With the latest version, if I try to deserialize an
out-of-date XML file I get an exception *before* my constructor starts to
run. Visual Studio reports:

A first chance exception of type
'System.Runtime.Serialization.SerializationException' occurred in
system.runtime.serialization.formatters.soap.dll
The message is: Top Object cannot be instantiated for element 'mListColor'.

mListColor is a field that no longer exists; however even if I do the
obvious thing and add it back, I still get the same error.

The serialization and deserialization works fine with newly serialized
files; it is just deserializing the old version that is not working.

How can I troubleshoot this?

Thanks for any advice,

Tim



Relevant Pages

  • Serializing exceptions
    ... I have an ASP.NET 2 web service that needs to return a serialized exception from its methods so that the caller can take specific actions for certain exceptions. ... XML serialisation throws an exception on serialization due to not being able to serialize Dictionary objects. ... The stream that deserializes the data shows the correct length prior to calling the formatter's Deserialize method. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Serialization, HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ... Can you give us some more information on the exception being thrown? ... OR if you wish to include a script sample in your post please add "Use of ... > Hey, I'm working with serialization, my app look to serialize fine, but ... when I go to Deserialize it give an Exception ...
    (microsoft.public.dotnet.languages.csharp)
  • SOAP serialization exception
    ... I've been able to deserialize out-of-date versions by handling serialization ... A first chance exception of type ... Top Object cannot be instantiated for element 'mListColor'. ...
    (microsoft.public.dotnet.framework.webservices)
  • SOAP serialization exception
    ... I've been able to deserialize out-of-date versions by handling serialization ... A first chance exception of type ... Top Object cannot be instantiated for element 'mListColor'. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Using multi-object graph with ISerializable interface
    ... Both the the parent and the children also inherit from the same base class. ... I do not understand how the name/value pairs can separate out the different classes when there is a collection and when they are all inheriting from the same base class. ... > As for the .net serialization, you may take a look at the links below. ... > to fully deserialize the object. ...
    (microsoft.public.dotnet.framework)