예제 #1
0
 private void CreateEtwProvider(Guid etwProviderId)
 {
     if ((etwProviderId != Guid.Empty) && isVistaOrGreater)
     {
         this.etwProvider = (System.Runtime.Diagnostics.EtwProvider)etwProviderCache[etwProviderId];
         if (this.etwProvider == null)
         {
             lock (etwProviderCache)
             {
                 this.etwProvider = (System.Runtime.Diagnostics.EtwProvider)etwProviderCache[etwProviderId];
                 if (this.etwProvider == null)
                 {
                     this.etwProvider = new System.Runtime.Diagnostics.EtwProvider(etwProviderId);
                     etwProviderCache.Add(etwProviderId, this.etwProvider);
                 }
             }
         }
         this.etwProviderId = etwProviderId;
     }
 }
 public DiagnosticTrace(string traceSourceName, Guid etwProviderId)
 {
     try
     {
         this.thisLock = new object();
         this.TraceSourceName = traceSourceName;
         this.eventSourceName = this.TraceSourceName + " " + "4.0.0.0";
         this.LastFailure = DateTime.MinValue;
         this.CreateTraceSource();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         new EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, 4, 0xc0010064, false, new string[] { exception.ToString() });
     }
     try
     {
         this.CreateEtwProvider(etwProviderId);
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         this.etwProvider = null;
         new EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, 4, 0xc0010064, false, new string[] { exception2.ToString() });
     }
     if (this.TracingEnabled || this.EtwTracingEnabled)
     {
         this.AddDomainEventHandlersForCleanup();
     }
 }
예제 #3
0
 public DiagnosticTrace(string traceSourceName, Guid etwProviderId)
 {
     try
     {
         this.thisLock        = new object();
         this.TraceSourceName = traceSourceName;
         this.eventSourceName = this.TraceSourceName + " " + "4.0.0.0";
         this.LastFailure     = DateTime.MinValue;
         this.CreateTraceSource();
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         new EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, 4, 0xc0010064, false, new string[] { exception.ToString() });
     }
     try
     {
         this.CreateEtwProvider(etwProviderId);
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         this.etwProvider = null;
         new EventLogger(this.eventSourceName, null).LogEvent(TraceEventType.Error, 4, 0xc0010064, false, new string[] { exception2.ToString() });
     }
     if (this.TracingEnabled || this.EtwTracingEnabled)
     {
         this.AddDomainEventHandlersForCleanup();
     }
 }
 private void CreateEtwProvider(Guid etwProviderId)
 {
     if ((etwProviderId != Guid.Empty) && isVistaOrGreater)
     {
         this.etwProvider = (System.Runtime.Diagnostics.EtwProvider) etwProviderCache[etwProviderId];
         if (this.etwProvider == null)
         {
             lock (etwProviderCache)
             {
                 this.etwProvider = (System.Runtime.Diagnostics.EtwProvider) etwProviderCache[etwProviderId];
                 if (this.etwProvider == null)
                 {
                     this.etwProvider = new System.Runtime.Diagnostics.EtwProvider(etwProviderId);
                     etwProviderCache.Add(etwProviderId, this.etwProvider);
                 }
             }
         }
         this.etwProviderId = etwProviderId;
     }
 }