Home All Groups Group Topic Archive Search About

Binary serializing of dataset in framework 2.0

Author
30 Jan 2006 11:58 AM
Anders
I was eager to try the new binary serialization of dataset in version 2.0 of
the framework. The new serialization seems to be very fast comparede to the
"binary" serialization in framework 1.1. However I have a few problems
consering columns of the type Date:

Columns set to the value of Date.MinValue and Date.MaxValue get corruptede
depending on the what time zone my computer is set to:

1. When time zone is set to Greenwich Mean Time (GMT) everything works just
fine.
2. When time zone is set to something east of GMT for example GMT +1
(Denmark) coulms with the value Date.MinValue are corrupted during the
serialization and deserialization.
3. When time zone is set to something west of GMT for example GMT -6
(Central Time US) coulms with the value Date.MaxValue are corrupted during
the serialization and deserialization.

I also expirience problems with null valus:

Columns with null values will be set to Date.MinVaule after deserialization
when time time zone is east of GMT.

Is this a bug or am i doing something worg?

I use the code below to demostrate this behaviour:

'Create a dataset for test purpose
'--------------------------------------
        Dim drNew As DataRow
        Me.DatasetOriginal = New DataSet

        Me.DatasetOriginal.Tables.Add("TEST")
        Me.DatasetOriginal.Tables("TEST").Columns.Add("Id", GetType(Integer))
        Me.DatasetOriginal.Tables("TEST").Columns.Add("Name", GetType(String))
        Me.DatasetOriginal.Tables("TEST").Columns.Add("Date", GetType(Date))
        Me.DatasetOriginal.Tables("TEST").Columns.Add("Number",
GetType(Integer))
        Me.DatasetOriginal.Tables("TEST").Columns.Add("Bool",
GetType(Boolean))

        drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
        drNew.Item("Id") = 1
        drNew.Item("Name") = "My name"
        drNew.Item("Date") = Date.MaxValue
        drNew.Item("Number") = 13
        drNew.Item("Bool") = True
        Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)

        drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
        drNew.Item("Id") = 2
        drNew.Item("Date") = Date.MinValue
        drNew.Item("Number") = 13
        drNew.Item("Bool") = True
        Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)

        drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
        drNew.Item("Id") = 3
        drNew.Item("Name") = "My name"
        drNew.Item("Number") = 13
        drNew.Item("Bool") = True
        Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)

        drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
        drNew.Item("Id") = 4
        drNew.Item("Name") = "My name"
        drNew.Item("Date") = Date.Now
        drNew.Item("Bool") = True
        Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)

        drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
        drNew.Item("Id") = 5
        drNew.Item("Name") = "My name"
        drNew.Item("Date") = Date.Now
        drNew.Item("Number") = 13
        Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)

'Serialize dataset
'-------------------
        Dim bin As New
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
        Dim Writer2 As New System.IO.StreamWriter("C:\DatasetSerialized.dat")

        Try
            DatasetOriginal.WriteXml("C:\Serialized.xml",
XmlWriteMode.WriteSchema)

            DatasetOriginal.RemotingFormat = SerializationFormat.Binary
            bin.Serialize(Writer2.BaseStream, DatasetOriginal)
            Writer2.Close()
            Writer2 = Nothing
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

'DeSerializer dataset
'-----------------------
        Dim bin As New
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
        Dim Reader As New System.IO.StreamReader("C:\DatasetSerialized.dat")

        Try
            DatasetSerialized = New DataSet
            DatasetSerialized.RemotingFormat = SerializationFormat.Binary
            DatasetSerialized = bin.Deserialize(Reader.BaseStream)
            Reader.Close()
            Reader = Nothing

            DatasetSerialized.WriteXml("C:\DeSerialized.xml",
XmlWriteMode.WriteSchema)

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

Author
1 Feb 2006 1:26 PM
Kay-Christian Wessel
Have you tried to use SerializationFormat.XML to see if there is any
difference ?

You could serialize as XML and then use the new compression features to make
the XML smaller. It will reduce the size to 4 % of the original size. It's
very nice with resources. Only 40 milliseconds on a 1 mb Dataset using the
Deflate compression.

Best regards
Kay-Christian Wessel

Show quote
"Anders" <And***@discussions.microsoft.com> skrev i melding
news:4B3446FA-A752-4C96-9B18-EDA884E498FB@microsoft.com...
> I was eager to try the new binary serialization of dataset in version 2.0
of
> the framework. The new serialization seems to be very fast comparede to
the
> "binary" serialization in framework 1.1. However I have a few problems
> consering columns of the type Date:
>
> Columns set to the value of Date.MinValue and Date.MaxValue get corruptede
> depending on the what time zone my computer is set to:
>
> 1. When time zone is set to Greenwich Mean Time (GMT) everything works
just
> fine.
> 2. When time zone is set to something east of GMT for example GMT +1
> (Denmark) coulms with the value Date.MinValue are corrupted during the
> serialization and deserialization.
> 3. When time zone is set to something west of GMT for example GMT -6
> (Central Time US) coulms with the value Date.MaxValue are corrupted during
> the serialization and deserialization.
>
> I also expirience problems with null valus:
>
> Columns with null values will be set to Date.MinVaule after
deserialization
> when time time zone is east of GMT.
>
> Is this a bug or am i doing something worg?
>
> I use the code below to demostrate this behaviour:
>
> 'Create a dataset for test purpose
> '--------------------------------------
>         Dim drNew As DataRow
>         Me.DatasetOriginal = New DataSet
>
>         Me.DatasetOriginal.Tables.Add("TEST")
>         Me.DatasetOriginal.Tables("TEST").Columns.Add("Id",
GetType(Integer))
>         Me.DatasetOriginal.Tables("TEST").Columns.Add("Name",
GetType(String))
>         Me.DatasetOriginal.Tables("TEST").Columns.Add("Date",
GetType(Date))
>         Me.DatasetOriginal.Tables("TEST").Columns.Add("Number",
> GetType(Integer))
>         Me.DatasetOriginal.Tables("TEST").Columns.Add("Bool",
> GetType(Boolean))
>
>         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
>         drNew.Item("Id") = 1
>         drNew.Item("Name") = "My name"
>         drNew.Item("Date") = Date.MaxValue
>         drNew.Item("Number") = 13
>         drNew.Item("Bool") = True
>         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
>
>         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
>         drNew.Item("Id") = 2
>         drNew.Item("Date") = Date.MinValue
>         drNew.Item("Number") = 13
>         drNew.Item("Bool") = True
>         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
>
>         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
>         drNew.Item("Id") = 3
>         drNew.Item("Name") = "My name"
>         drNew.Item("Number") = 13
>         drNew.Item("Bool") = True
>         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
>
>         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
>         drNew.Item("Id") = 4
>         drNew.Item("Name") = "My name"
>         drNew.Item("Date") = Date.Now
>         drNew.Item("Bool") = True
>         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
>
>         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
>         drNew.Item("Id") = 5
>         drNew.Item("Name") = "My name"
>         drNew.Item("Date") = Date.Now
>         drNew.Item("Number") = 13
>         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
>
> 'Serialize dataset
> '-------------------
>         Dim bin As New
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
>         Dim Writer2 As New
System.IO.StreamWriter("C:\DatasetSerialized.dat")
Show quote
>
>         Try
>             DatasetOriginal.WriteXml("C:\Serialized.xml",
> XmlWriteMode.WriteSchema)
>
>             DatasetOriginal.RemotingFormat = SerializationFormat.Binary
>             bin.Serialize(Writer2.BaseStream, DatasetOriginal)
>             Writer2.Close()
>             Writer2 = Nothing
>         Catch ex As Exception
>             MessageBox.Show(ex.Message)
>         End Try
>
> 'DeSerializer dataset
> '-----------------------
>         Dim bin As New
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
>         Dim Reader As New
System.IO.StreamReader("C:\DatasetSerialized.dat")
Show quote
>
>         Try
>             DatasetSerialized = New DataSet
>             DatasetSerialized.RemotingFormat = SerializationFormat.Binary
>             DatasetSerialized = bin.Deserialize(Reader.BaseStream)
>             Reader.Close()
>             Reader = Nothing
>
>             DatasetSerialized.WriteXml("C:\DeSerialized.xml",
> XmlWriteMode.WriteSchema)
>
>         Catch ex As Exception
>             MessageBox.Show(ex.Message)
>         End Try
>
Author
9 Feb 2006 2:05 PM
Anders
I have now tried the to serialize to XML and it seems to work fine.

so it seems to me that this is a bug in the binary serialization.

Anders


Show quote
"Kay-Christian Wessel" wrote:

> Have you tried to use SerializationFormat.XML to see if there is any
> difference ?
>
> You could serialize as XML and then use the new compression features to make
> the XML smaller. It will reduce the size to 4 % of the original size. It's
> very nice with resources. Only 40 milliseconds on a 1 mb Dataset using the
> Deflate compression.
>
> Best regards
> Kay-Christian Wessel
>
> "Anders" <And***@discussions.microsoft.com> skrev i melding
> news:4B3446FA-A752-4C96-9B18-EDA884E498FB@microsoft.com...
> > I was eager to try the new binary serialization of dataset in version 2.0
> of
> > the framework. The new serialization seems to be very fast comparede to
> the
> > "binary" serialization in framework 1.1. However I have a few problems
> > consering columns of the type Date:
> >
> > Columns set to the value of Date.MinValue and Date.MaxValue get corruptede
> > depending on the what time zone my computer is set to:
> >
> > 1. When time zone is set to Greenwich Mean Time (GMT) everything works
> just
> > fine.
> > 2. When time zone is set to something east of GMT for example GMT +1
> > (Denmark) coulms with the value Date.MinValue are corrupted during the
> > serialization and deserialization.
> > 3. When time zone is set to something west of GMT for example GMT -6
> > (Central Time US) coulms with the value Date.MaxValue are corrupted during
> > the serialization and deserialization.
> >
> > I also expirience problems with null valus:
> >
> > Columns with null values will be set to Date.MinVaule after
> deserialization
> > when time time zone is east of GMT.
> >
> > Is this a bug or am i doing something worg?
> >
> > I use the code below to demostrate this behaviour:
> >
> > 'Create a dataset for test purpose
> > '--------------------------------------
> >         Dim drNew As DataRow
> >         Me.DatasetOriginal = New DataSet
> >
> >         Me.DatasetOriginal.Tables.Add("TEST")
> >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Id",
> GetType(Integer))
> >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Name",
> GetType(String))
> >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Date",
> GetType(Date))
> >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Number",
> > GetType(Integer))
> >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Bool",
> > GetType(Boolean))
> >
> >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> >         drNew.Item("Id") = 1
> >         drNew.Item("Name") = "My name"
> >         drNew.Item("Date") = Date.MaxValue
> >         drNew.Item("Number") = 13
> >         drNew.Item("Bool") = True
> >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> >
> >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> >         drNew.Item("Id") = 2
> >         drNew.Item("Date") = Date.MinValue
> >         drNew.Item("Number") = 13
> >         drNew.Item("Bool") = True
> >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> >
> >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> >         drNew.Item("Id") = 3
> >         drNew.Item("Name") = "My name"
> >         drNew.Item("Number") = 13
> >         drNew.Item("Bool") = True
> >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> >
> >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> >         drNew.Item("Id") = 4
> >         drNew.Item("Name") = "My name"
> >         drNew.Item("Date") = Date.Now
> >         drNew.Item("Bool") = True
> >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> >
> >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> >         drNew.Item("Id") = 5
> >         drNew.Item("Name") = "My name"
> >         drNew.Item("Date") = Date.Now
> >         drNew.Item("Number") = 13
> >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> >
> > 'Serialize dataset
> > '-------------------
> >         Dim bin As New
> > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> >         Dim Writer2 As New
> System.IO.StreamWriter("C:\DatasetSerialized.dat")
> >
> >         Try
> >             DatasetOriginal.WriteXml("C:\Serialized.xml",
> > XmlWriteMode.WriteSchema)
> >
> >             DatasetOriginal.RemotingFormat = SerializationFormat.Binary
> >             bin.Serialize(Writer2.BaseStream, DatasetOriginal)
> >             Writer2.Close()
> >             Writer2 = Nothing
> >         Catch ex As Exception
> >             MessageBox.Show(ex.Message)
> >         End Try
> >
> > 'DeSerializer dataset
> > '-----------------------
> >         Dim bin As New
> > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> >         Dim Reader As New
> System.IO.StreamReader("C:\DatasetSerialized.dat")
> >
> >         Try
> >             DatasetSerialized = New DataSet
> >             DatasetSerialized.RemotingFormat = SerializationFormat.Binary
> >             DatasetSerialized = bin.Deserialize(Reader.BaseStream)
> >             Reader.Close()
> >             Reader = Nothing
> >
> >             DatasetSerialized.WriteXml("C:\DeSerialized.xml",
> > XmlWriteMode.WriteSchema)
> >
> >         Catch ex As Exception
> >             MessageBox.Show(ex.Message)
> >         End Try
> >
>
>
>
Author
10 Feb 2006 9:36 AM
Kay-Christian Wessel
It is a pity since the binary serialization produced 80 % smaller output
compared to the XML serialization, using less than 10 % of the resources.

You will report this bug to Microsoft ?

Best regards
Kay-Christian Wessel

Show quote
"Anders" <And***@discussions.microsoft.com> skrev i melding
news:50554057-114D-46AF-9A66-EA85966CBA1C@microsoft.com...
> I have now tried the to serialize to XML and it seems to work fine.
>
> so it seems to me that this is a bug in the binary serialization.
>
> Anders
>
>
> "Kay-Christian Wessel" wrote:
>
> > Have you tried to use SerializationFormat.XML to see if there is any
> > difference ?
> >
> > You could serialize as XML and then use the new compression features to
make
> > the XML smaller. It will reduce the size to 4 % of the original size.
It's
> > very nice with resources. Only 40 milliseconds on a 1 mb Dataset using
the
> > Deflate compression.
> >
> > Best regards
> > Kay-Christian Wessel
> >
> > "Anders" <And***@discussions.microsoft.com> skrev i melding
> > news:4B3446FA-A752-4C96-9B18-EDA884E498FB@microsoft.com...
> > > I was eager to try the new binary serialization of dataset in version
2.0
> > of
> > > the framework. The new serialization seems to be very fast comparede
to
> > the
> > > "binary" serialization in framework 1.1. However I have a few problems
> > > consering columns of the type Date:
> > >
> > > Columns set to the value of Date.MinValue and Date.MaxValue get
corruptede
> > > depending on the what time zone my computer is set to:
> > >
> > > 1. When time zone is set to Greenwich Mean Time (GMT) everything works
> > just
> > > fine.
> > > 2. When time zone is set to something east of GMT for example GMT +1
> > > (Denmark) coulms with the value Date.MinValue are corrupted during the
> > > serialization and deserialization.
> > > 3. When time zone is set to something west of GMT for example GMT -6
> > > (Central Time US) coulms with the value Date.MaxValue are corrupted
during
> > > the serialization and deserialization.
> > >
> > > I also expirience problems with null valus:
> > >
> > > Columns with null values will be set to Date.MinVaule after
> > deserialization
> > > when time time zone is east of GMT.
> > >
> > > Is this a bug or am i doing something worg?
> > >
> > > I use the code below to demostrate this behaviour:
> > >
> > > 'Create a dataset for test purpose
> > > '--------------------------------------
> > >         Dim drNew As DataRow
> > >         Me.DatasetOriginal = New DataSet
> > >
> > >         Me.DatasetOriginal.Tables.Add("TEST")
> > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Id",
> > GetType(Integer))
> > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Name",
> > GetType(String))
> > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Date",
> > GetType(Date))
> > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Number",
> > > GetType(Integer))
> > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Bool",
> > > GetType(Boolean))
> > >
> > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > >         drNew.Item("Id") = 1
> > >         drNew.Item("Name") = "My name"
> > >         drNew.Item("Date") = Date.MaxValue
> > >         drNew.Item("Number") = 13
> > >         drNew.Item("Bool") = True
> > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > >
> > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > >         drNew.Item("Id") = 2
> > >         drNew.Item("Date") = Date.MinValue
> > >         drNew.Item("Number") = 13
> > >         drNew.Item("Bool") = True
> > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > >
> > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > >         drNew.Item("Id") = 3
> > >         drNew.Item("Name") = "My name"
> > >         drNew.Item("Number") = 13
> > >         drNew.Item("Bool") = True
> > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > >
> > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > >         drNew.Item("Id") = 4
> > >         drNew.Item("Name") = "My name"
> > >         drNew.Item("Date") = Date.Now
> > >         drNew.Item("Bool") = True
> > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > >
> > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > >         drNew.Item("Id") = 5
> > >         drNew.Item("Name") = "My name"
> > >         drNew.Item("Date") = Date.Now
> > >         drNew.Item("Number") = 13
> > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > >
> > > 'Serialize dataset
> > > '-------------------
> > >         Dim bin As New
> > > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> > >         Dim Writer2 As New
> > System.IO.StreamWriter("C:\DatasetSerialized.dat")
> > >
> > >         Try
> > >             DatasetOriginal.WriteXml("C:\Serialized.xml",
> > > XmlWriteMode.WriteSchema)
> > >
> > >             DatasetOriginal.RemotingFormat =
SerializationFormat.Binary
> > >             bin.Serialize(Writer2.BaseStream, DatasetOriginal)
> > >             Writer2.Close()
> > >             Writer2 = Nothing
> > >         Catch ex As Exception
> > >             MessageBox.Show(ex.Message)
> > >         End Try
> > >
> > > 'DeSerializer dataset
> > > '-----------------------
> > >         Dim bin As New
> > > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> > >         Dim Reader As New
> > System.IO.StreamReader("C:\DatasetSerialized.dat")
> > >
> > >         Try
> > >             DatasetSerialized = New DataSet
> > >             DatasetSerialized.RemotingFormat =
SerializationFormat.Binary
> > >             DatasetSerialized = bin.Deserialize(Reader.BaseStream)
> > >             Reader.Close()
> > >             Reader = Nothing
> > >
> > >             DatasetSerialized.WriteXml("C:\DeSerialized.xml",
> > > XmlWriteMode.WriteSchema)
> > >
> > >         Catch ex As Exception
> > >             MessageBox.Show(ex.Message)
> > >         End Try
> > >
> >
> >
> >
Author
10 Feb 2006 2:47 PM
Anders
I would like to report it as a bug, but I am not sure how to do that.

Was is the official place to submit a bug report?

Anders

Show quote
"Kay-Christian Wessel" wrote:

> It is a pity since the binary serialization produced 80 % smaller output
> compared to the XML serialization, using less than 10 % of the resources.
>
> You will report this bug to Microsoft ?
>
> Best regards
> Kay-Christian Wessel
>
> "Anders" <And***@discussions.microsoft.com> skrev i melding
> news:50554057-114D-46AF-9A66-EA85966CBA1C@microsoft.com...
> > I have now tried the to serialize to XML and it seems to work fine.
> >
> > so it seems to me that this is a bug in the binary serialization.
> >
> > Anders
> >
> >
> > "Kay-Christian Wessel" wrote:
> >
> > > Have you tried to use SerializationFormat.XML to see if there is any
> > > difference ?
> > >
> > > You could serialize as XML and then use the new compression features to
> make
> > > the XML smaller. It will reduce the size to 4 % of the original size.
> It's
> > > very nice with resources. Only 40 milliseconds on a 1 mb Dataset using
> the
> > > Deflate compression.
> > >
> > > Best regards
> > > Kay-Christian Wessel
> > >
> > > "Anders" <And***@discussions.microsoft.com> skrev i melding
> > > news:4B3446FA-A752-4C96-9B18-EDA884E498FB@microsoft.com...
> > > > I was eager to try the new binary serialization of dataset in version
> 2.0
> > > of
> > > > the framework. The new serialization seems to be very fast comparede
> to
> > > the
> > > > "binary" serialization in framework 1.1. However I have a few problems
> > > > consering columns of the type Date:
> > > >
> > > > Columns set to the value of Date.MinValue and Date.MaxValue get
> corruptede
> > > > depending on the what time zone my computer is set to:
> > > >
> > > > 1. When time zone is set to Greenwich Mean Time (GMT) everything works
> > > just
> > > > fine.
> > > > 2. When time zone is set to something east of GMT for example GMT +1
> > > > (Denmark) coulms with the value Date.MinValue are corrupted during the
> > > > serialization and deserialization.
> > > > 3. When time zone is set to something west of GMT for example GMT -6
> > > > (Central Time US) coulms with the value Date.MaxValue are corrupted
> during
> > > > the serialization and deserialization.
> > > >
> > > > I also expirience problems with null valus:
> > > >
> > > > Columns with null values will be set to Date.MinVaule after
> > > deserialization
> > > > when time time zone is east of GMT.
> > > >
> > > > Is this a bug or am i doing something worg?
> > > >
> > > > I use the code below to demostrate this behaviour:
> > > >
> > > > 'Create a dataset for test purpose
> > > > '--------------------------------------
> > > >         Dim drNew As DataRow
> > > >         Me.DatasetOriginal = New DataSet
> > > >
> > > >         Me.DatasetOriginal.Tables.Add("TEST")
> > > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Id",
> > > GetType(Integer))
> > > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Name",
> > > GetType(String))
> > > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Date",
> > > GetType(Date))
> > > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Number",
> > > > GetType(Integer))
> > > >         Me.DatasetOriginal.Tables("TEST").Columns.Add("Bool",
> > > > GetType(Boolean))
> > > >
> > > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > > >         drNew.Item("Id") = 1
> > > >         drNew.Item("Name") = "My name"
> > > >         drNew.Item("Date") = Date.MaxValue
> > > >         drNew.Item("Number") = 13
> > > >         drNew.Item("Bool") = True
> > > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > > >
> > > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > > >         drNew.Item("Id") = 2
> > > >         drNew.Item("Date") = Date.MinValue
> > > >         drNew.Item("Number") = 13
> > > >         drNew.Item("Bool") = True
> > > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > > >
> > > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > > >         drNew.Item("Id") = 3
> > > >         drNew.Item("Name") = "My name"
> > > >         drNew.Item("Number") = 13
> > > >         drNew.Item("Bool") = True
> > > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > > >
> > > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > > >         drNew.Item("Id") = 4
> > > >         drNew.Item("Name") = "My name"
> > > >         drNew.Item("Date") = Date.Now
> > > >         drNew.Item("Bool") = True
> > > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > > >
> > > >         drNew = Me.DatasetOriginal.Tables("TEST").NewRow()
> > > >         drNew.Item("Id") = 5
> > > >         drNew.Item("Name") = "My name"
> > > >         drNew.Item("Date") = Date.Now
> > > >         drNew.Item("Number") = 13
> > > >         Me.DatasetOriginal.Tables("TEST").Rows.Add(drNew)
> > > >
> > > > 'Serialize dataset
> > > > '-------------------
> > > >         Dim bin As New
> > > > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> > > >         Dim Writer2 As New
> > > System.IO.StreamWriter("C:\DatasetSerialized.dat")
> > > >
> > > >         Try
> > > >             DatasetOriginal.WriteXml("C:\Serialized.xml",
> > > > XmlWriteMode.WriteSchema)
> > > >
> > > >             DatasetOriginal.RemotingFormat =
> SerializationFormat.Binary
> > > >             bin.Serialize(Writer2.BaseStream, DatasetOriginal)
> > > >             Writer2.Close()
> > > >             Writer2 = Nothing
> > > >         Catch ex As Exception
> > > >             MessageBox.Show(ex.Message)
> > > >         End Try
> > > >
> > > > 'DeSerializer dataset
> > > > '-----------------------
> > > >         Dim bin As New
> > > > System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> > > >         Dim Reader As New
> > > System.IO.StreamReader("C:\DatasetSerialized.dat")
> > > >
> > > >         Try
> > > >             DatasetSerialized = New DataSet
> > > >             DatasetSerialized.RemotingFormat =
> SerializationFormat.Binary
> > > >             DatasetSerialized = bin.Deserialize(Reader.BaseStream)
> > > >             Reader.Close()
> > > >             Reader = Nothing
> > > >
> > > >             DatasetSerialized.WriteXml("C:\DeSerialized.xml",
> > > > XmlWriteMode.WriteSchema)
> > > >
> > > >         Catch ex As Exception
> > > >             MessageBox.Show(ex.Message)
> > > >         End Try
> > > >
> > >
> > >
> > >
>
>
>

AddThis Social Bookmark Button