Assembly is not marked serializable

Jul 1 2014 12:28 PM
 

As an application we have Customised Toolbar utilising CCF toolbar libraries which loads Main application DLL in its App domain.Toolbar has functionality to create multiple instances of main application and display & manage using Toolbar Navigator window

Now when we go ahead to close one application instances running under toolbar we get Application exception which prevents Instances from Closing and we get below mentioned error

Exception Error

Type 'System.Windows.Forms.FormClosedEventArgs' in Assembly is not marked as serializable.

Also when we go ahead to close Application through Main Application we get Serialization error

Type 'System.Windows.Forms.FormClosedEventArgs' in Assembly is not marked as serializable.

Observation:- Original code was in 1.1 and Migrated to 4.0 framework. Looks likely its issue the way Serialization is handled. Exception raised across thread prevents application from clean exit

Application communicates across thread using delegate’s call-back.

Stack trace for Same

Server stack trace:

at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)

at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)

at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)

at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)

at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeMessageParts(ArrayList argsToSerialize)

at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage..ctor(IMethodCallMessage mcm)

at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.SmuggleIfPossible(IMessage msg)

at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)

at Bellsouth.CCF.COM.DomainRunner.RunInDefaultAppDomain(Delegate delg, Object sender, Object[] args) in c:\Program Files\ABM\Toolbar_Final\Bellsouth.CCF.COM.Local\Bellsouth\CCF\COM\DomainRunner.cs:line 51

at Bellsouth.CCF.COM.HostedApplicationAdapter.HandleFormClosed(Object sender, EventArgs args) in c:\Program Files\ABM\Toolbar_Final\Bellsouth.CCF.COM.Local\Bellsouth\CCF\COM\HostedApplicationAdapter.cs:line 304

at System.EventHandler.Invoke(Object sender, EventArgs e)

at System.Windows.Forms.Form.OnClosed(EventArgs e)

at System.Windows.Forms.Form.WmClose(Message& m)

at System.Windows.Forms.Form.WndProc(Message& m)

at ROS.ApplicationControl.ROSMDIForm.WndProc(Message& m) in c:\ABM_ROS1\trunk\ROSV2\Src\client\ROSFramework\ApplicationControl\ROSMDIForm.cs:line 764

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)