예제 #1
0
        [System.Security.SecurityCritical] // auto-generated
#endif
        private string GetStackTrace(bool needFileInfo)
        {
            string stackTraceString       = _stackTraceString;
            string remoteStackTraceString = _remoteStackTraceString;

#if !FEATURE_CORECLR
            if (!needFileInfo)
            {
                // Filter out file names/paths and line numbers from _stackTraceString and _remoteStackTraceString.
                // This is used only when generating stack trace for Watson where the strings must be PII-free.
                stackTraceString       = StripFileInfo(stackTraceString, false);
                remoteStackTraceString = StripFileInfo(remoteStackTraceString, true);
            }
#endif // !FEATURE_CORECLR

            // if no stack trace, try to get one
            if (stackTraceString != null)
            {
                return(remoteStackTraceString + stackTraceString);
            }
            if (_stackTrace == null)
            {
                return(remoteStackTraceString);
            }

            // Obtain the stack trace string. Note that since Environment.GetStackTrace
            // will add the path to the source file if the PDB is present and a demand
            // for FileIOPermission(PathDiscovery) succeeds, we need to make sure we
            // don't store the stack trace string in the _stackTraceString member variable.
            String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo);
            return(remoteStackTraceString + tempStackTraceString);
        }
예제 #2
0
        [System.Security.SecurityCritical]  // auto-generated_required
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            Contract.EndContractBlock();

            String tempStackTraceString = _stackTraceString;

            if (_stackTrace != null)
            {
                if (tempStackTraceString == null)
                {
                    tempStackTraceString = Environment.GetStackTrace(this, true);
                }
                if (_exceptionMethod == null)
                {
                    _exceptionMethod = GetExceptionMethodFromStackTrace();
                }
            }

            if (_source == null)
            {
                _source = Source; // Set the Source information correctly before serialization
            }

            info.AddValue("ClassName", GetClassName(), 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));

            // Serialize the Watson bucket details as well
            info.AddValue("WatsonBuckets", _watsonBuckets, typeof(byte[]));

#if FEATURE_SERIALIZATION
            if (_safeSerializationManager != null && _safeSerializationManager.IsActive)
            {
                info.AddValue("SafeSerializationManager", _safeSerializationManager, typeof(SafeSerializationManager));

                // User classes derived from Exception must have a valid _safeSerializationManager.
                // Exceptions defined in mscorlib don't use this field might not have it initalized (since they are
                // often created in the VM with AllocateObject instead if the managed construtor)
                // If you are adding code to use a SafeSerializationManager from an mscorlib exception, update
                // this assert to ensure that it fails when that exception's _safeSerializationManager is NULL
                Contract.Assert(((_safeSerializationManager != null) || (this.GetType().Assembly == typeof(object).Assembly)),
                                "User defined exceptions must have a valid _safeSerializationManager");

                // Handle serializing any transparent or partial trust subclass data
                _safeSerializationManager.CompleteSerialization(this, info, context);
            }
#endif // FEATURE_SERIALIZATION
        }
예제 #3
0
        [System.Security.SecurityCritical] // auto-generated
        #endif
        private string GetStackTrace(bool needFileInfo)
        {
            string stackTraceString       = _stackTraceString;
            string remoteStackTraceString = _remoteStackTraceString;

#if !FEATURE_CORECLR
            if (!needFileInfo)
            {
                // 从堆栈轨迹或远程堆栈轨迹中,过滤文件名/路径和行号
                // 这是只有当生成堆栈跟踪用于字符串必须PII-free沃森。
                stackTraceString       = StripFileInfo(stackTraceString, false);
                remoteStackTraceString = StripFileInfo(remoteStackTraceString, true);
            }
#endif // !FEATURE_CORECLR

            // if no stack trace, try to get one
            if (stackTraceString != null)
            {
                return(remoteStackTraceString + stackTraceString);
            }
            if (_stackTrace == null)
            {
                return(remoteStackTraceString);
            }

            // Obtain the stack trace string. Note that since Environment.GetStackTrace
            // will add the path to the source file if the PDB is present and a demand
            // for FileIOPermission(PathDiscovery) succeeds, we need to make sure we
            // don't store the stack trace string in the _stac、kTraceString member variable.
            String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo);
            return(remoteStackTraceString + tempStackTraceString);
        }
예제 #4
0
        private string GetStackTrace(bool needFileInfo)
        {
            if (this._stackTraceString != null)
            {
                return(this._remoteStackTraceString + this._stackTraceString);
            }
            if (this._stackTrace == null)
            {
                return(this._remoteStackTraceString);
            }
            string stackTrace = Environment.GetStackTrace(this, needFileInfo);

            return(this._remoteStackTraceString + stackTrace);
        }
        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));
        }
예제 #6
0
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }
            Contract.EndContractBlock();

            String tempStackTraceString = _stackTraceString;

            if (_stackTrace != null)
            {
                if (tempStackTraceString == null)
                {
                    tempStackTraceString = Environment.GetStackTrace(this, true);
                }
                if (_exceptionMethod == null)
                {
                    _exceptionMethod = GetExceptionMethodFromStackTrace();
                }
            }

            if (_source == null)
            {
                _source = Source; // Set the Source information correctly before serialization
            }

            info.AddValue("ClassName", GetClassName(), 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));

            // Serialize the Watson bucket details as well
            info.AddValue("WatsonBuckets", _watsonBuckets, typeof(byte[]));
        }
예제 #7
0
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            string str = this._stackTraceString;

            if (this._stackTrace != null)
            {
                if (str == null)
                {
                    str = Environment.GetStackTrace(this, true);
                }
                if (this._exceptionMethod == (MethodBase)null)
                {
                    this._exceptionMethod = this.GetExceptionMethodFromStackTrace();
                }
            }
            if (this._source == null)
            {
                this._source = this.Source;
            }
            info.AddValue("ClassName", (object)this.GetClassName(), typeof(string));
            info.AddValue("Message", (object)this._message, typeof(string));
            info.AddValue("Data", (object)this._data, typeof(IDictionary));
            info.AddValue("InnerException", (object)this._innerException, typeof(Exception));
            info.AddValue("HelpURL", (object)this._helpURL, typeof(string));
            info.AddValue("StackTraceString", (object)str, typeof(string));
            info.AddValue("RemoteStackTraceString", (object)this._remoteStackTraceString, typeof(string));
            info.AddValue("RemoteStackIndex", (object)this._remoteStackIndex, typeof(int));
            info.AddValue("ExceptionMethod", (object)this.GetExceptionMethodString(), typeof(string));
            info.AddValue("HResult", this.HResult);
            info.AddValue("Source", (object)this._source, typeof(string));
            info.AddValue("WatsonBuckets", this._watsonBuckets, typeof(byte[]));
            if (this._safeSerializationManager == null || !this._safeSerializationManager.IsActive)
            {
                return;
            }
            info.AddValue("SafeSerializationManager", (object)this._safeSerializationManager, typeof(SafeSerializationManager));
            this._safeSerializationManager.CompleteSerialization((object)this, info, context);
        }
예제 #8
0
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            string stackTrace = this._stackTraceString;

            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            if (this._className == null)
            {
                this._className = this.GetClassName();
            }
            if (this._stackTrace != null)
            {
                if (stackTrace == null)
                {
                    stackTrace = Environment.GetStackTrace(this, true);
                }
                if (this._exceptionMethod == null)
                {
                    RuntimeMethodHandle typicalMethodDefinition = InternalGetMethod(this._stackTrace).GetTypicalMethodDefinition();
                    this._exceptionMethod = RuntimeType.GetMethodBase(typicalMethodDefinition);
                }
            }
            if (this._source == null)
            {
                this._source = this.Source;
            }
            info.AddValue("ClassName", this._className, typeof(string));
            info.AddValue("Message", this._message, typeof(string));
            info.AddValue("Data", this._data, typeof(IDictionary));
            info.AddValue("InnerException", this._innerException, typeof(Exception));
            info.AddValue("HelpURL", this._helpURL, typeof(string));
            info.AddValue("StackTraceString", stackTrace, typeof(string));
            info.AddValue("RemoteStackTraceString", this._remoteStackTraceString, typeof(string));
            info.AddValue("RemoteStackIndex", this._remoteStackIndex, typeof(int));
            info.AddValue("ExceptionMethod", this.GetExceptionMethodString(), typeof(string));
            info.AddValue("HResult", this.HResult);
            info.AddValue("Source", this._source, typeof(string));
        }
        // Token: 0x060005BD RID: 1469 RVA: 0x00014370 File Offset: 0x00012570
        private string GetStackTrace(bool needFileInfo)
        {
            string text  = this._stackTraceString;
            string text2 = this._remoteStackTraceString;

            if (!needFileInfo)
            {
                text  = this.StripFileInfo(text, false);
                text2 = this.StripFileInfo(text2, true);
            }
            if (text != null)
            {
                return(text2 + text);
            }
            if (this._stackTrace == null)
            {
                return(text2);
            }
            string stackTrace = Environment.GetStackTrace(this, needFileInfo);

            return(text2 + stackTrace);
        }
예제 #10
0
        /// <include file='doc\Exception.uex' path='docs/doc[@for="Exception.GetObjectData"]/*' />
        public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            if (_className == null)
            {
                _className = GetClassName();
            }

            if (_stackTrace != null)
            {
                if (_stackTraceString == null)
                {
                    _stackTraceString = Environment.GetStackTrace(this);
                }
                if (_exceptionMethod == null)
                {
                    _exceptionMethod = InternalGetMethod(_stackTrace);
                }
            }

            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("InnerException", _innerException, typeof(Exception));
            info.AddValue("HelpURL", _helpURL, typeof(String));
            info.AddValue("StackTraceString", _stackTraceString, 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));
        }
예제 #11
0
        private string GetStackTrace(bool needFileInfo)
        {
            string stackTrace1 = this._stackTraceString;
            string stackTrace2 = this._remoteStackTraceString;

            if (!needFileInfo)
            {
                stackTrace1 = this.StripFileInfo(stackTrace1, false);
                stackTrace2 = this.StripFileInfo(stackTrace2, true);
            }
            if (stackTrace1 != null)
            {
                return(stackTrace2 + stackTrace1);
            }
            if (this._stackTrace == null)
            {
                return(stackTrace2);
            }
            string stackTrace3 = Environment.GetStackTrace(this, needFileInfo);

            return(stackTrace2 + stackTrace3);
        }
예제 #12
0
        // Computes and returns the stack trace as a string
        // Attempts to get source file and line number information if needFileInfo
        // is true.  Note that this requires FileIOPermission(PathDiscovery), and so
        // will usually fail in CoreCLR.  To avoid the demand and resulting
        // SecurityException we can explicitly not even try to get fileinfo.
        private string GetStackTrace(bool needFileInfo)
        {
            string stackTraceString = _stackTraceString;
            string remoteStackTraceString = _remoteStackTraceString;

            // if no stack trace, try to get one
            if (stackTraceString != null)
            {
                return remoteStackTraceString + stackTraceString;
            }
            if (_stackTrace == null)
            {
                return remoteStackTraceString;
            }

            // Obtain the stack trace string. Note that since Environment.GetStackTrace
            // will add the path to the source file if the PDB is present and a demand
            // for FileIOPermission(PathDiscovery) succeeds, we need to make sure we 
            // don't store the stack trace string in the _stackTraceString member variable.
            String tempStackTraceString = Environment.GetStackTrace(this, needFileInfo);
            return remoteStackTraceString + tempStackTraceString;
        }