System.Xml.Tests.ExceptionVerifier.ExceptionInfoOutput C# (CSharp) Method

ExceptionInfoOutput() private method

private ExceptionInfoOutput ( ) : void
return void
        private void ExceptionInfoOutput()
        {
            // Use reflection to obtain "res" property value
            var exceptionType = _ex.GetType();
            var fInfo = exceptionType.GetField("res", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase) ??
                        exceptionType.GetTypeInfo().BaseType.GetField("res", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase);

            if (fInfo == null)
                throw new VerifyException("Cannot obtain Resource ID from Exception.");

            _output.WriteLine(
                            "\n===== Original Exception Message =====\n" + _ex.Message +
                            "\n===== Resource Id =====\n" + fInfo.GetValue(_ex) +
                            "\n===== HelpLink =====\n" + _ex.HelpLink +
                            "\n===== Source =====\n" + _ex.Source /*+
                            "\n===== TargetSite =====\n" + ex.TargetSite + "\n"*/);

            _output.WriteLine(
                            "\n===== InnerException =====\n" + _ex.InnerException +
                            "\n===== StackTrace =====\n" + _ex.StackTrace);
        }