Binary Serialization Issue
-
I'm having some issues with an attempt to serialize an object to file using a BinaryFormatter. The error I keep getting is: The type System.Runtime.Remoting.ServerIdentity in Assembly mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable. Problem #1, I have no idea where I am referencing ServerIdentity. This is the method I am running in at the time of error: Private Shared Sub DumpUnprocessedDeployments() Try Dim cntr As Integer = CollInstance.Count If cntr > 0 Then logger.WriteLog("Dumping " + cntr.ToString.Trim() + " unprocessed deployments....") Dim s As Stream = File.Open("bin\webdeploy.dmp", FileMode.OpenOrCreate, FileAccess.ReadWrite) Dim bf As New BinaryFormatter Dim dpl As Deployment Dim al As New ArrayList For Each dpl In CollInstance logger.WriteLog(dpl.Project + " " + dpl.State + " " + dpl.Package + " Requester: " + dpl.User, False) bf.Serialize(s, dpl) ' <=== ERRORS OUT HERE Next s.Close() Else logger.WriteLog("No Unprocessed Deployments to Dump") End If Catch ex As Exception logger.WriteLog("An ERROR was Encountered while Generating the Dump File....") logger.WriteLog(ex.Message, False) End Try End Sub Here is the Code for the Serialized Object: Imports System Imports CM.WebDeployment.Interfaces Public Class Deployment Inherits MarshalByRefObject Implements IDeployment Private IsPending As Boolean Private RunWhen As Date Private FTPDir As String Private FTPPwd As String Private FTPSvr As String Private FTPUsr As String Private HPkg As String Private HPwd As String Private HProj As String Private HState As String Private HUsr As String #Region " Object Constructor(s) " Public Sub New() MyBase.New() End Sub Public Sub New(ByVal HarProj As String, ByVal HarState As String, ByVal HarPackage As String, _ ByVal HarUser As String, ByVal HarPassword As String, ByVal FServer As String, _ ByVal FDir As String, ByVal FUser As String, ByVal FPassword As String, _ ByVal RunTime As Date) MyBase.New() HProj = HarProj HState = HarState HPkg = HarPackage HUsr = HarUser