I need to pass a custom exception class via .Net remoting but I am getting the error:
Type 'MyDll.Security.InvalidHashException' in Assembly 'MyDll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.'
The InvalidHashException class is as follows:
Public Class InvalidHashException
Inherits Exception
Public Sub New()
End Sub
Public Sub New(ByVal message As String)
MyBase.New(message)
End Sub
Public Sub New(ByVal message As String, ByVal inner As Exception)
MyBase.New(message, inner)
End Sub
End Class
I understand that I have to add the <Serializable()>
attribute to the class but then I get the following error:
System.Runtime.Serialization.SerializationException: 'The constructor to deserialize an object of type 'MyDll.Security.InvalidHashException' was not found.'
Can someone please help with how I would add a constructor that would help deserialize this object.
Many thanks.