Hi,
My scenario is as follows:
I have an application, in which in one component, I am calling a method in a different thread. Please note that this method will load a dynamic assembly.
Now in case of multi-user environment, am getting following exception:
################################################## ###############
Exception: System.Runtime.Serialization.SerializationExceptio n
Message: Type 'ABC.Framework.XY.ServiceHelper.ServiceLogicExcept ion' in Assembly 'ABC.Framework.XY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
StackTrace: at System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter)
at System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Remoting.Channels.CrossAppDomainSer ializer.SerializeObject(Object obj, MemoryStream stm)
at System.AppDomain.Serialize(Object o)
at System.AppDomain.MarshalObject(Object o)
################################################## #################
Now it can be possibly due to the thread crossing the app domain boundary, throwing an exception which the other app domain then tries to serialize and since it is not marked as Serilizable throws the above exception.
Can this be the case ?
In this regards,
Is it possible to confine a new thread to the same app domain as the calling thread ?