'oProcess.oApp = App.oApp.Clone()
oProcess.oApp = DeepCopy(App.oApp)
So, instead of cloning, I went for a deep copy. The method is like this:''' <summary> ''' Using generics will solve some performance issues ''' </summary> ''' <typeparam name="T"></typeparam> ''' <param name="item"></param> ''' <returns></returns> Public Function DeepCopy(Of T)(item As T) As T Dim formatter As New BinaryFormatter() Dim stream As New MemoryStream() formatter.Serialize(stream, item) stream.Seek(0, SeekOrigin.Begin) Dim result As T = DirectCast(formatter.Deserialize(stream), T) stream.Close() Return result End FunctionI also had to adjust the App class such as:
<Serializable> _ Public Class App Public oAdmin As Admin = New Admin() Public Countries As New Countries Public Messages As New Messages Public Provinces As New Provinces Public Tables As New Tables Public Shared oApp As Framework.App = New Framework.App() End Class ' Admin class <Serializable> _ Public Class Admin <NonSerialized> Public oRow As DataRow End Class <Serializable> _ Public Class Tables End Class <Serializable> _ Public Class Messages End Class <Serializable> _ Public Class Provinces End Class <Serializable> _ Public Class Countries End ClassSo, everything that had to be defined as Serializable in the App class has been adjusted. I had to assign a public property in the Admin class as NonSerialized.