public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
String tempStackTraceString = _stackTraceString;
if (info==null)
{
throw new ArgumentNullException("info");
}
if (_className==null)
{
_className=GetClassName();
}
if (_stackTrace!=null)
{
if (tempStackTraceString==null)
{
tempStackTraceString = Environment.GetStackTrace(this, true);
}
if (_exceptionMethod==null)
{
RuntimeMethodHandle method = InternalGetMethod(_stackTrace).GetTypicalMethodDefinition();
_exceptionMethod = RuntimeType.GetMethodBase(method);
}
}
if (_source == null)
{
_source = Source; // Set the Source information correctly before serialization
}
info.AddValue("ClassName", _className, typeof(String));
info.AddValue("Message", _message, typeof(String));
info.AddValue("Data", _data, typeof(IDictionary));
info.AddValue("InnerException", _innerException, typeof(Exception));
info.AddValue("HelpURL", _helpURL, typeof(String));
info.AddValue("StackTraceString", tempStackTraceString, typeof(String));
info.AddValue("RemoteStackTraceString", _remoteStackTraceString, typeof(String));
info.AddValue("RemoteStackIndex", _remoteStackIndex, typeof(Int32));
info.AddValue("ExceptionMethod", GetExceptionMethodString(), typeof(String));
info.AddValue("HResult", HResult);
info.AddValue("Source", _source, typeof(String));
}