salve a tutti,

è da molto che non entro in questo forum.

volevo fare una domanda:

ho un programma scritto in vb6 che usa l'oggetto PropertyBag per scrivere un file in binario.
ora io vorrrei tentare di leggere tale file in vb.net tramitre questa funzione trovata in rete:

codice:
    Function LoadBinaryData(ByVal path As String) As Object
        ' Open a file stream for input
        Dim fs As FileStream = New FileStream(path, FileMode.Open)
        ' Create a binary formatter for this stream
        Dim bf As New BinaryFormatter()
        ' Deserialize the contents of the file stream into an object
        LoadBinaryData = bf.Deserialize(fs)
        ' close the stream.
        fs.Close()
    End Function
c'è un problema però: quando il programma arriva a bf.Deserialize mi esce questo errore:

SerializationException non è stata gestita
Codice di tipo non valido nel flusso 'Invalid'.

come posso risovere?

grazie in anticipo