二进制流' 48'不包含有效的BinaryHeader。可能的原因是序列化和反序列化之间的无效流或对象版本更改
Dim fs As FileStream = Nothing
Try
fs = IO.File.OpenRead(Filename)
Dim bf As New Runtime.Serialization.Formatters.Binary.BinaryFormatter()
bf.AssemblyFormat = Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full
bf.TypeFormat = Runtime.Serialization.Formatters.FormatterTypeStyle.TypesWhenNeeded
fs.Position = 0
Dim obj As Object = bf.Deserialize(fs)
Return obj
Catch ex As Exception
MsgBox("There was an exception while trying to convert binary file to object. Exception: " & ex.Message & " | Stacktrace: " & ex.StackTrace)
Finally
If fs IsNot Nothing Then
fs.Close()
End If
End Try
任何人都可以帮助我。