0 Replies Latest reply: Apr 4, 2013 6:26 AM by 878029 RSS

    Managed ODP.NET: Mark exeption classes as serializable

    878029
      In .NET the exception classes should be marked with [Serializable] attribute. This allows the exception data to flow out of .NET, like being saved to a file, being sent as error messages over web services etc.

      In my case I get a SerializationException when trying to pass the exception over an .NET appdomain.


      System.Runtime.Serialization.SerializationException: Type 'OracleInternal.Network.NetworkException' in Assembly 'Oracle.ManagedDataAccess, Version=4.112.3.50, Culture=neutral, PublicKeyToken=89b483f429c47342' is not marked as serializable.
      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.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
      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.SerializeObject(Object obj, MemoryStream stm)
      at System.AppDomain.Serialize(Object o)
      at System.AppDomain.MarshalObject(Object o)