Re: Yet another .net bug?

Discussion in 'ASP .Net' started by Anon, Jan 18, 2004.

  1. Anon

    Anon Guest

    According to the documentation:

    "Note that when a class implements the ICollection interface, only the
    collection contained by the class is serialized. Any public properties or
    fields added to the class will not be serialized. "


    "Bryan Martin" <, > wrote in message
    news:...
    > Within the last couple of weeks it seems that every complex project must
    > come to a halt due to bugs in the framework. Can someone look at the
    > included class and confirm/deny or generally point me to a location which
    > explains a workaround.
    >
    > The problem that I am seeing is that I am trying to serialize a strongly
    > typed collection named parent which intern implements a internal

    collections
    > of children. When you attempt to output this to a xml file you lose any
    > properties within the parent. You dont get any errors or anything but you
    > only get the parent with no properties. However, removing the internal
    > collection will allow the parent to be saved out correctly.
    >
    > See attached file or http://www.myplaceinspace.com/collectionbug.txt
    >
    >
    >
     
    Anon, Jan 18, 2004
    #1
    1. Advertising

  2. Anon

    Jan Tielens Guest

    Anon, you're right! In a collection even public members won't be serialized.
    Thx for correction my post! ;-)

    --
    Greetz,
    Jan
    __________________________________
    Read my weblog: http://weblogs.asp.net/jan
    "Anon" <> schreef in bericht
    news:X_BOb.94197$I06.416615@attbi_s01...
    > According to the documentation:
    >
    > "Note that when a class implements the ICollection interface, only the
    > collection contained by the class is serialized. Any public properties or
    > fields added to the class will not be serialized. "
    >
    >
    > "Bryan Martin" <, > wrote in message
    > news:...
    > > Within the last couple of weeks it seems that every complex project must
    > > come to a halt due to bugs in the framework. Can someone look at the
    > > included class and confirm/deny or generally point me to a location

    which
    > > explains a workaround.
    > >
    > > The problem that I am seeing is that I am trying to serialize a strongly
    > > typed collection named parent which intern implements a internal

    > collections
    > > of children. When you attempt to output this to a xml file you lose any
    > > properties within the parent. You dont get any errors or anything but

    you
    > > only get the parent with no properties. However, removing the internal
    > > collection will allow the parent to be saved out correctly.
    > >
    > > See attached file or http://www.myplaceinspace.com/collectionbug.txt
    > >
    > >
    > >

    >
    >
     
    Jan Tielens, Jan 18, 2004
    #2
    1. Advertising

  3. Anon

    Bryan Martin Guest

    Thanks Anon. Do you know of a workaround?

    "Anon" <> wrote in message
    news:X_BOb.94197$I06.416615@attbi_s01...
    > According to the documentation:
    >
    > "Note that when a class implements the ICollection interface, only the
    > collection contained by the class is serialized. Any public properties or
    > fields added to the class will not be serialized. "
    >
    >
    > "Bryan Martin" <, > wrote in message
    > news:...
    > > Within the last couple of weeks it seems that every complex project must
    > > come to a halt due to bugs in the framework. Can someone look at the
    > > included class and confirm/deny or generally point me to a location

    which
    > > explains a workaround.
    > >
    > > The problem that I am seeing is that I am trying to serialize a strongly
    > > typed collection named parent which intern implements a internal

    > collections
    > > of children. When you attempt to output this to a xml file you lose any
    > > properties within the parent. You dont get any errors or anything but

    you
    > > only get the parent with no properties. However, removing the internal
    > > collection will allow the parent to be saved out correctly.
    > >
    > > See attached file or http://www.myplaceinspace.com/collectionbug.txt
    > >
    > >
    > >

    >
    >
     
    Bryan Martin, Jan 18, 2004
    #3
  4. Anon

    Anon Guest

    I would redo the class to something like this prototype class:

    Class ParentObject
    Property Name as String
    Property Children as ChildrentListType 'where children list type is the
    actual list that implements collection base and it has no custom properties.
    End Class

    The reason being its probably more OO correct. Think about actual parent and
    children relationships. A parent isn't a collection of children with a name.
    A parent is an object with properties (name) and one property being a
    collection of children.

    But if you want to keep what you have, I have not done this with a
    collection so I'm not positive but you could try implementing ISerializable
    interface on the collection. Basically take over serialization for the
    collection.



    "Bryan Martin" <, > wrote in message
    news:uv0$...
    > Thanks Anon. Do you know of a workaround?
    >
    > "Anon" <> wrote in message
    > news:X_BOb.94197$I06.416615@attbi_s01...
    > > According to the documentation:
    > >
    > > "Note that when a class implements the ICollection interface, only the
    > > collection contained by the class is serialized. Any public properties

    or
    > > fields added to the class will not be serialized. "
    > >
    > >
    > > "Bryan Martin" <, > wrote in message
    > > news:...
    > > > Within the last couple of weeks it seems that every complex project

    must
    > > > come to a halt due to bugs in the framework. Can someone look at the
    > > > included class and confirm/deny or generally point me to a location

    > which
    > > > explains a workaround.
    > > >
    > > > The problem that I am seeing is that I am trying to serialize a

    strongly
    > > > typed collection named parent which intern implements a internal

    > > collections
    > > > of children. When you attempt to output this to a xml file you lose

    any
    > > > properties within the parent. You dont get any errors or anything but

    > you
    > > > only get the parent with no properties. However, removing the

    internal
    > > > collection will allow the parent to be saved out correctly.
    > > >
    > > > See attached file or http://www.myplaceinspace.com/collectionbug.txt
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Anon, Jan 19, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hermit Dave

    Re: Yet another .net bug?

    Hermit Dave, Jan 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    414
    Hermit Dave
    Jan 18, 2004
  2. Jan Tielens

    Re: Yet another .net bug?

    Jan Tielens, Jan 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    431
    Jan Tielens
    Jan 18, 2004
  3. Berehem
    Replies:
    4
    Views:
    562
    Lawrence Kirby
    Apr 28, 2005
  4. Replies:
    2
    Views:
    323
  5. Roedy Green

    Yet another bug in 1.7.0_21

    Roedy Green, Apr 17, 2013, in forum: Java
    Replies:
    4
    Views:
    302
    Roedy Green
    Apr 18, 2013
Loading...

Share This Page