I wrote the following code, but the line MessageBox.Show(sr.ReadToEnd) didn’t show anything? Does anyone know what I’m doing wrong?
I want to send an exception object to a web service for remote logging – is there a better method, (minimum amount of code, so I don’t want to have to create a special transfer object that you copy the exception objct to and would like it a bit more flexible than .tostring)
Dim sf As New System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Try
Integer.Parse("A")
Catch ex As Exception
Using ms As New IO.MemoryStream()
sf.Serialize(ms, ex)
Using sr As New IO.StreamReader(ms)
MessageBox.Show(sr.ReadToEnd)
End Using
End Using
End Try
You need to reset the Position: