コード例 #1
0
 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);
     }
 }
コード例 #4
0
        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);
            }
        }