Example #1
0
        public void WriteTraceSource(ref EventDescriptor eventDescriptor, string description, TracePayload payload)
        {
            string str = null;
            int    num = 0;
            string empty;

            if (base.TracingEnabled)
            {
                XPathNavigator xPathNavigator = null;
                try
                {
                    EtwDiagnosticTrace.GenerateLegacyTraceCode(ref eventDescriptor, out str, out num);
                    string      str1        = EtwDiagnosticTrace.BuildTrace(ref eventDescriptor, description, payload, str);
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.LoadXml(str1);
                    xPathNavigator = xmlDocument.CreateNavigator();
                    base.TraceSource.TraceData(TraceLevelHelper.GetTraceEventType(eventDescriptor.Level, eventDescriptor.Opcode), num, xPathNavigator);
                    if (base.CalledShutdown)
                    {
                        base.TraceSource.Flush();
                    }
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    if (!Fx.IsFatal(exception))
                    {
                        EtwDiagnosticTrace etwDiagnosticTrace = this;
                        if (xPathNavigator == null)
                        {
                            empty = string.Empty;
                        }
                        else
                        {
                            empty = xPathNavigator.ToString();
                        }
                        etwDiagnosticTrace.LogTraceFailure(empty, exception);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }