Beispiel #1
0
        private void OnDeserialized(StreamingContext context)
        {
            _stackTrace = null;

#if !MONO
            // We wont serialize or deserialize the IP for Watson bucketing since
            // we dont know where the deserialized object will be used in.
            // Using it across process or an AppDomain could be invalid and result
            // in AV in the runtime.
            //
            // Hence, we set it to zero when deserialization takes place.
            _ipForWatsonBuckets = UIntPtr.Zero;
#endif

#if FEATURE_SERIALIZATION
            if (_safeSerializationManager == null)
            {
                _safeSerializationManager = new SafeSerializationManager();
            }
            else
            {
                _safeSerializationManager.CompleteDeserialization(this);
            }
#endif // FEATURE_SERIALIZATION
        }
Beispiel #2
0
 protected Exception(SerializationInfo info, StreamingContext context)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     this._className                = info.GetString("ClassName");
     this._message                  = info.GetString("Message");
     this._data                     = (IDictionary)info.GetValueNoThrow("Data", typeof(IDictionary));
     this._innerException           = (Exception)info.GetValue("InnerException", typeof(Exception));
     this._helpURL                  = info.GetString("HelpURL");
     this._stackTraceString         = info.GetString("StackTraceString");
     this._remoteStackTraceString   = info.GetString("RemoteStackTraceString");
     this._remoteStackIndex         = info.GetInt32("RemoteStackIndex");
     this._exceptionMethodString    = (string)info.GetValue("ExceptionMethod", typeof(string));
     this.HResult                   = info.GetInt32("HResult");
     this._source                   = info.GetString("Source");
     this._watsonBuckets            = info.GetValueNoThrow("WatsonBuckets", typeof(byte[]));
     this._safeSerializationManager = info.GetValueNoThrow("SafeSerializationManager", typeof(SafeSerializationManager)) as SafeSerializationManager;
     if ((this._className == null) || (this.HResult == 0))
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
     }
     if (context.State == StreamingContextStates.CrossAppDomain)
     {
         this._remoteStackTraceString = this._remoteStackTraceString + this._stackTraceString;
         this._stackTraceString       = null;
     }
 }
 private void OnDeserialized(StreamingContext context)
 {
     this._stackTrace         = null;
     this._ipForWatsonBuckets = UIntPtr.Zero;
     if (this._safeSerializationManager == null)
     {
         this._safeSerializationManager = new SafeSerializationManager();
         return;
     }
     this._safeSerializationManager.CompleteDeserialization(this);
 }
Beispiel #4
0
 private void Init()
 {
     this._message                  = null;
     this._stackTrace               = null;
     this._dynamicMethods           = null;
     this.HResult                   = -2146233088;
     this._xcode                    = -532462766;
     this._xptrs                    = IntPtr.Zero;
     this._watsonBuckets            = null;
     this._ipForWatsonBuckets       = UIntPtr.Zero;
     this._safeSerializationManager = new SafeSerializationManager();
 }
Beispiel #5
0
        private void Init()
        {
            _message        = null;
            _stackTrace     = null;
            _dynamicMethods = null;
            HResult         = __HResults.COR_E_EXCEPTION;
            _xcode          = _COMPlusExceptionCode;
            _xptrs          = (IntPtr)0;

            // Initialize the WatsonBuckets to be null
            _watsonBuckets = null;

            // Initialize the watson bucketing IP
            _ipForWatsonBuckets = UIntPtr.Zero;

#if FEATURE_SERIALIZATION
            _safeSerializationManager = new SafeSerializationManager();
#endif // FEATURE_SERIALIZATION
        }
Beispiel #6
0
        /// <summary>
        /// 初始化相关字段
        /// </summary>
        private void Init()
        {
            _message        = null;                       //获取描述当前异常的消息。
            _stackTrace     = null;                       //得到的字符串表示的直接调用堆栈帧。
            _dynamicMethods = null;                       //多态方法
            HResult         = __HResults.COR_E_EXCEPTION; //获取或设置 HRESULT(一个分配给特定异常的编码数字值)。
            _xcode          = _COMPlusExceptionCode;
            _xptrs          = (IntPtr)0;

            // 初始化WatsonBuckets 为空
            _watsonBuckets = null;

            // 初始化沃森桶装IP
            _ipForWatsonBuckets = UIntPtr.Zero;

#if FEATURE_SERIALIZATION
            _safeSerializationManager = new SafeSerializationManager(); //安全序列化管理
#endif // FEATURE_SERIALIZATION
        }
Beispiel #7
0
        private void OnDeserialized(StreamingContext context)
        {
            _stackTrace = null;

            // 我们不会序列化或反序列化的IP沃森用桶装,因为我们不知道反序列化对象将使用的地方。
            // 使用跨进程或一个应用程序域中可能无效,导致AV在运行时。
            // 因此,我们把它反序列化发生时为零。
            _ipForWatsonBuckets = UIntPtr.Zero;

#if FEATURE_SERIALIZATION
            if (_safeSerializationManager == null)//
            {
                _safeSerializationManager = new SafeSerializationManager();
            }
            else
            {
                _safeSerializationManager.CompleteDeserialization(this);
            }
#endif // FEATURE_SERIALIZATION
        }
Beispiel #8
0
 private void Init()
 {
     this._message = null;
     this._safeSerializationManager = new SafeSerializationManager();
 }