Ejemplo n.º 1
0
 private void CreateEtwProvider(Guid etwProviderId)
 {
     if (etwProviderId != Guid.Empty && DiagnosticTrace.isVistaOrGreater)
     {
         this.etwProvider = (Microsoft.ServiceBus.Common.Diagnostics.EtwProvider)DiagnosticTrace.etwProviderCache[etwProviderId];
         if (this.etwProvider == null)
         {
             lock (DiagnosticTrace.etwProviderCache)
             {
                 this.etwProvider = (Microsoft.ServiceBus.Common.Diagnostics.EtwProvider)DiagnosticTrace.etwProviderCache[etwProviderId];
                 if (this.etwProvider == null)
                 {
                     this.etwProvider = new Microsoft.ServiceBus.Common.Diagnostics.EtwProvider(etwProviderId);
                     DiagnosticTrace.etwProviderCache.Add(etwProviderId, this.etwProvider);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public DiagnosticTrace(string traceSourceName, Guid etwProviderId)
 {
     try
     {
         this.thisLock        = new object();
         this.TraceSourceName = traceSourceName;
         this.eventSourceName = string.Concat(this.TraceSourceName, " ", "4.0.0.0");
         this.LastFailure     = DateTime.MinValue;
         this.CreateTraceSource();
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         EventLogger eventLogger = new EventLogger(this.eventSourceName, null);
         string[]    str         = new string[] { exception.ToString() };
         eventLogger.LogEvent(TraceEventType.Error, 4, -1073676188, false, str);
     }
     try
     {
         this.CreateEtwProvider(etwProviderId);
     }
     catch (Exception exception3)
     {
         Exception exception2 = exception3;
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         this.etwProvider = null;
         EventLogger eventLogger1 = new EventLogger(this.eventSourceName, null);
         string[]    strArrays    = new string[] { exception2.ToString() };
         eventLogger1.LogEvent(TraceEventType.Error, 4, -1073676188, false, strArrays);
     }
     if (this.TracingEnabled || this.EtwTracingEnabled)
     {
         this.AddDomainEventHandlersForCleanup();
     }
 }