Deserialization Problems ... The constructor to deserialize an object of type ... was not found

在做动态调用时碰到一个问题,The constructor to deserialize an object of type 'MSNException' was not found,其中MSNException 标记为Serializable tag,并且MSNException 从 Exception 继承,而且Exception本身已经实现ISerializable interface ,这使我非常的困惑,后来我查看Exception源代码看到这样一个构造函数
/// <summary>Initializes a new instance of the <see cref="T:System.Exception"></see> class with serialized data.</summary>
        
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"></see> that contains contextual information about the source or destination. </param>
        
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> that holds the serialized object data about the exception being thrown. </param>
        
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"></see> is zero (0). </exception>
        
/// <exception cref="T:System.ArgumentNullException">The info parameter is null. </exception>

        protected Exception(SerializationInfo info, StreamingContext context)
        
{

恍然大悟,遂添加一个MSNException构造函数,问题解决

public MSNException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            : 
base(info, context)
        
{
        }
posted @ 2006-04-20 16:32  upzone  阅读(1127)  评论(2编辑  收藏  举报