public static void Trace(TraceEventType type, int traceCode, string description)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         Guid empty             = Guid.Empty;
         Guid guid              = Guid.Empty;
         IComThreadingInfo info = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
         if (info != null)
         {
             info.GetCurrentLogicalThreadId(out empty);
             IObjectContextInfo info2 = info as IObjectContextInfo;
             if (info2 != null)
             {
                 info2.GetActivityId(out guid);
             }
         }
         ComPlusActivitySchema schema = new ComPlusActivitySchema(guid, empty, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId());
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         Guid empty = Guid.Empty;
         Guid guid = Guid.Empty;
         IComThreadingInfo info = (IComThreadingInfo) SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
         if (info != null)
         {
             info.GetCurrentLogicalThreadId(out empty);
             IObjectContextInfo info2 = info as IObjectContextInfo;
             if (info2 != null)
             {
                 info2.GetActivityId(out guid);
             }
         }
         ComPlusActivitySchema schema = new ComPlusActivitySchema(guid, empty, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId());
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         Guid guidLogicalThreadID = Guid.Empty;
         Guid guidActivityID      = Guid.Empty;
         IComThreadingInfo comThreadingInfo;
         comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
         if (comThreadingInfo != null)
         {
             comThreadingInfo.GetCurrentLogicalThreadId(out guidLogicalThreadID);
             IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
             if (contextInfo != null)
             {
                 contextInfo.GetActivityId(out guidActivityID);
             }
         }
         ComPlusActivitySchema record =
             new ComPlusActivitySchema(guidActivityID, guidLogicalThreadID,
                                       System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId());
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
        public static void Trace(TraceEventType type, int traceCode, string description)
        {

            if (DiagnosticUtility.ShouldTrace(type))
            {
                Guid guidLogicalThreadID = Guid.Empty;
                Guid guidActivityID = Guid.Empty;
                IComThreadingInfo comThreadingInfo;
                comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
                if (comThreadingInfo != null)
                {
                    comThreadingInfo.GetCurrentLogicalThreadId(out guidLogicalThreadID);
                    IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
                    if (contextInfo != null)
                    {
                        contextInfo.GetActivityId(out guidActivityID);
                    }
                }
                ComPlusActivitySchema record =
                    new ComPlusActivitySchema(guidActivityID, guidLogicalThreadID,
                    System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId());
                TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
            }
        }