Re: How to Serialize Class with System.Net.IPAddress Attribute?

Tech-Archive recommends: Fix windows errors by optimizing your registry



O.B. wrote:
I have a an attribute within a Serializable class that is of type System.Net.IPAddress. When I try to serialize the class, I get the following error:

System.InvalidOperationException: Cannot serialize member 'SerializationTest.ConfigurationProperties.ConnectionAddress' of type 'System.Net.IPAddress', see inner exception for more details.

System.InvalidOperationException: System.Net.IPAddress cannot be serialized because it does not have a parameterless constructor.

What workarounds are there?

Well, one workaround is to change the type from IPAddress to a string. That seems to work for now. If there is something better, please let me know.
.



Relevant Pages

  • How to Serialize Class with System.Net.IPAddress Attribute?
    ... I have a an attribute within a Serializable class that is of type System.Net.IPAddress. ... When I try to serialize the class, ... System.Net.IPAddress cannot be serialized because it does not have a parameterless constructor. ... What workarounds are there? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: XmlSerializer and a Collection Property
    ... attempt to serialize the parent object: ... "There was an error generating the XML document." ... Inner Inner Exception: "Object reference not set to an instance of an ... What happens if you comment out the collection property? ...
    (microsoft.public.dotnet.framework)
  • XmlSerializer and a Collection Property
    ... I am attempting to serialize an object using the XmlSerializer, ... Top Level Exception: "There was an error generating the XML document." ... Inner Inner Exception: "Object reference not set to an instance of an ...
    (microsoft.public.dotnet.framework)
  • XmlSerialization of Exceptions
    ... I have a class which derives from ApplicationException. ... I am trying to serialize this using the XmlSerializer. ... inner exception, it always blows up with the same problem since it will try ...
    (microsoft.public.dotnet.framework)
  • Re: Serialize Person Object
    ... > Cannot serialize member CDO.PersonClass.DataSource of type CDO.IDataSource ... MemoryStream and return that string, then on the client, deserialize the ... My .NET Blog: http://weblogs.asp.net/fbouma ...
    (microsoft.public.dotnet.languages.csharp)