void CallEtwMileStoneEvent(TraceEventType type, DictionaryTraceRecord record)
        {
            switch (type)
            {
            case TraceEventType.Start:

                if (TD.StartSignpostEventIsEnabled())
                {
                    TD.StartSignpostEvent(record);
                }
                break;

            case TraceEventType.Stop:
                if (TD.StopSignpostEventIsEnabled())
                {
                    TD.StopSignpostEvent(record);
                }
                break;

            case TraceEventType.Suspend:
                if (TD.SuspendSignpostEventIsEnabled())
                {
                    TD.SuspendSignpostEvent(record);
                }
                break;

            case TraceEventType.Resume:
                if (TD.ResumeSignpostEventIsEnabled())
                {
                    TD.ResumeSignpostEvent(record);
                }
                break;
            }
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            if (element == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
            }
            object elementKey = this.GetElementKey(element);

            if (this.ContainsKey(elementKey))
            {
                ConfigurationElement element2 = base.BaseGet(elementKey);
                if (element2 != null)
                {
                    if (element2.ElementInformation.IsPresent)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigDuplicateKeyAtSameScope", new object[] { this.ElementName, elementKey })));
                    }
                    if (DiagnosticUtility.ShouldTraceWarning)
                    {
                        Dictionary <string, string> dictionary = new Dictionary <string, string>(6);
                        dictionary.Add("ElementName", this.ElementName);
                        dictionary.Add("Name", elementKey.ToString());
                        dictionary.Add("OldElementLocation", element2.ElementInformation.Source);
                        dictionary.Add("OldElementLineNumber", element2.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo));
                        dictionary.Add("NewElementLocation", element.ElementInformation.Source);
                        dictionary.Add("NewElementLineNumber", element.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo));
                        DictionaryTraceRecord extendedData = new DictionaryTraceRecord(dictionary);
                        TraceUtility.TraceEvent(TraceEventType.Warning, 0x80029, System.ServiceModel.SR.GetString("TraceCodeOverridingDuplicateConfigurationKey"), extendedData, this, null);
                    }
                }
            }
            base.BaseAdd(element);
        }
Esempio n. 3
0
 internal static void TraceExtensionTypeNotFound(ExtensionElement extensionElement)
 {
     if (DiagnosticUtility.ShouldTraceWarning)
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>(2);
         dictionary.Add("ExtensionName", extensionElement.Name);
         dictionary.Add("ExtensionType", extensionElement.Type);
         DictionaryTraceRecord extendedData = new DictionaryTraceRecord(dictionary);
         TraceUtility.TraceEvent(TraceEventType.Warning, 0x80045, System.ServiceModel.SR.GetString("TraceCodeExtensionTypeNotFound"), extendedData, null, null);
     }
 }
        internal static void TraceExtensionTypeNotFound(ExtensionElement extensionElement)
        {
            if (DiagnosticUtility.ShouldTraceWarning)
            {
                Dictionary <string, string> values = new Dictionary <string, string>(2);
                values.Add("ExtensionName", extensionElement.Name);
                values.Add("ExtensionType", extensionElement.Type);

                DictionaryTraceRecord traceRecord = new DictionaryTraceRecord(values);
                TraceUtility.TraceEvent(TraceEventType.Warning,
                                        TraceCode.ExtensionTypeNotFound,
                                        SR.GetString(SR.TraceCodeExtensionTypeNotFound),
                                        traceRecord,
                                        null,
                                        (Exception)null);
            }
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            if (null == element)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
            }

            // Is this a duplicate key?
            object newElementKey = this.GetElementKey(element);

            if (this.ContainsKey(newElementKey))
            {
                ConfigurationElement oldElement = this.BaseGet(newElementKey);
                if (null != oldElement)
                {
                    // Is oldElement present in the current level of config
                    // being manipulated (i.e. duplicate in same config file)
                    if (oldElement.ElementInformation.IsPresent)
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(
                                                                                      SR.GetString(SR.ConfigDuplicateKeyAtSameScope, this.ElementName, newElementKey)));
                    }
#if DESKTOP
                    else if (DiagnosticUtility.ShouldTraceWarning)
                    {
                        Dictionary <string, string> values = new Dictionary <string, string>(6);
                        values.Add("ElementName", this.ElementName);
                        values.Add("Name", newElementKey.ToString());
                        values.Add("OldElementLocation", oldElement.ElementInformation.Source);
                        values.Add("OldElementLineNumber", oldElement.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo));
                        values.Add("NewElementLocation", element.ElementInformation.Source);
                        values.Add("NewElementLineNumber", element.ElementInformation.LineNumber.ToString(NumberFormatInfo.CurrentInfo));

                        DictionaryTraceRecord traceRecord = new DictionaryTraceRecord(values);
                        TraceUtility.TraceEvent(TraceEventType.Warning,
                                                TraceCode.OverridingDuplicateConfigurationKey,
                                                SR.GetString(SR.TraceCodeOverridingDuplicateConfigurationKey),
                                                traceRecord,
                                                this,
                                                null);
                    }
#endif
                }
            }
            base.BaseAdd(element);
        }
Esempio n. 6
0
        private void CallEtwMileStoneEvent(TraceEventType type, DictionaryTraceRecord record)
        {
            TraceEventType type2 = type;

            if (type2 <= TraceEventType.Stop)
            {
                if (type2 != TraceEventType.Start)
                {
                    if (type2 == TraceEventType.Stop)
                    {
                        if (!TD.StopSignpostEventIsEnabled())
                        {
                            return;
                        }
                        TD.StopSignpostEvent(record);
                    }
                    return;
                }
            }
            else
            {
                switch (type2)
                {
                case TraceEventType.Suspend:
                    if (TD.SuspendSignpostEventIsEnabled())
                    {
                        TD.SuspendSignpostEvent(record);
                    }
                    return;

                case TraceEventType.Resume:
                    if (TD.ResumeSignpostEventIsEnabled())
                    {
                        TD.ResumeSignpostEvent(record);
                    }
                    return;
                }
                return;
            }
            if (TD.StartSignpostEventIsEnabled())
            {
                TD.StartSignpostEvent(record);
            }
        }
Esempio n. 7
0
 private static void DatagramSentOrReceived(NativeMsmqMessage.BufferProperty messageId, Message message, int traceCode, string traceDescription)
 {
     if (DiagnosticUtility.ShouldTraceVerbose)
     {
         Guid        guid         = MessageIdToGuid(messageId);
         UniqueId    id           = message.Headers.MessageId;
         TraceRecord extendedData = null;
         if (null == id)
         {
             extendedData = new StringTraceRecord("MSMQMessageId", guid.ToString());
         }
         else
         {
             Dictionary <string, string> dictionary2 = new Dictionary <string, string>(2);
             dictionary2.Add("MSMQMessageId", guid.ToString());
             dictionary2.Add("WCFMessageId", id.ToString());
             Dictionary <string, string> dictionary = dictionary2;
             extendedData = new DictionaryTraceRecord(dictionary);
         }
         TraceUtility.TraceEvent(TraceEventType.Verbose, traceCode, traceDescription, extendedData, null, null);
     }
 }
 static void DatagramSentOrReceived(NativeMsmqMessage.BufferProperty messageId, Message message, int traceCode, string traceDescription)
 {
     if (DiagnosticUtility.ShouldTraceVerbose)
     {
         Guid        msmqId   = MessageIdToGuid(messageId);
         UniqueId    indigoId = message.Headers.MessageId;
         TraceRecord record   = null;
         if (null == indigoId)
         {
             record = new StringTraceRecord("MSMQMessageId", msmqId.ToString());
         }
         else
         {
             Dictionary <string, string> dictionary = new Dictionary <string, string>(2)
             {
                 { "MSMQMessageId", msmqId.ToString() },
                 { "WCFMessageId", indigoId.ToString() }
             };
             record = new DictionaryTraceRecord(dictionary);
         }
         TraceUtility.TraceEvent(TraceEventType.Verbose, traceCode, traceDescription, record, null, null);
     }
 }