B
Boban Dragojlovic
For debug purposes, I need to occasionally dump an object to disk.
I wrote a method that looks like this:
Public sub Dump2Disk()
Dim formatter As New
System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Dim stream As System.IO.FileStream
Try
stream = File.Open(String.Format("c:\{0}.xml", Now.ToFileTime),
FileMode.Create)
formatter.Serialize(stream, Me)
Catch ex As Exception
Finally
If Not stream Is Nothing Then
stream.Close()
End If
End Try
End sub
But whether I try the SoapFormatter, or the BinaryFormatter, I get
essentially an empty file (I get the file headers, but none of the
variables).
The object ('Me') that I'm trying to dump has a number of variables, as well
as objects and structure variables. Nothing appears.
If I dump a single "simple" variable
(e.g. Formatter.Serialize(Stream, Me.SomeVariable)
then I will get just that variable
How can I get the entire object (ME) along with all that it owns?
I wrote a method that looks like this:
Public sub Dump2Disk()
Dim formatter As New
System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Dim stream As System.IO.FileStream
Try
stream = File.Open(String.Format("c:\{0}.xml", Now.ToFileTime),
FileMode.Create)
formatter.Serialize(stream, Me)
Catch ex As Exception
Finally
If Not stream Is Nothing Then
stream.Close()
End If
End Try
End sub
But whether I try the SoapFormatter, or the BinaryFormatter, I get
essentially an empty file (I get the file headers, but none of the
variables).
The object ('Me') that I'm trying to dump has a number of variables, as well
as objects and structure variables. Nothing appears.
If I dump a single "simple" variable
(e.g. Formatter.Serialize(Stream, Me.SomeVariable)
then I will get just that variable
How can I get the entire object (ME) along with all that it owns?