public IConnection EndAccept(IAsyncResult result) { using (ServiceModelActivity.BoundOperation(this.activity)) { ServiceModelActivity activity = ServiceModelActivity.CreateActivity(); if (activity != null) { if (null != FxTrace.Trace) { FxTrace.Trace.TraceTransfer(activity.Id); } } using (ServiceModelActivity.BoundOperation(activity)) { ServiceModelActivity.Start(activity, SR.GetString(SR.ActivityReceiveBytes, this.activity.Name), ActivityType.ReceiveBytes); IConnection innerConnection = this.listener.EndAccept(result); if (innerConnection == null) { return(null); } TracingConnection retval = new TracingConnection(innerConnection, activity); return(retval); } } }
public IConnection EndAccept(IAsyncResult result) { IConnection connection3; using (ServiceModelActivity.BoundOperation(this.activity)) { ServiceModelActivity activity = ServiceModelActivity.CreateActivity(); if ((activity != null) && (FxTrace.Trace != null)) { FxTrace.Trace.TraceTransfer(activity.Id); } using (ServiceModelActivity.BoundOperation(activity)) { ServiceModelActivity.Start(activity, System.ServiceModel.SR.GetString("ActivityReceiveBytes", new object[] { this.activity.Name }), ActivityType.ReceiveBytes); IConnection connection = this.listener.EndAccept(result); if (connection == null) { return(null); } TracingConnection connection2 = new TracingConnection(connection, activity); connection3 = connection2; } } return(connection3); }
public TracingConnection(IConnection connection, bool inheritCurrentActivity) : base(connection) { this.activity = inheritCurrentActivity ? ServiceModelActivity.CreateActivity(DiagnosticTrace.ActivityId, false) : ServiceModelActivity.CreateActivity(); if ((DiagnosticUtility.ShouldUseActivity && !inheritCurrentActivity) && (FxTrace.Trace != null)) { FxTrace.Trace.TraceTransfer(this.activity.Id); } }
int WbemNative.IWbemServices.GetObjectAsync( string objectPath, Int32 flags, WbemNative.IWbemContext wbemContext, WbemNative.IWbemObjectSink wbemSink) { if (wbemContext == null || wbemSink == null || this.wbemServices == null) { return((int)WbemNative.WbemStatus.WBEM_E_INVALID_PARAMETER); } using (ServiceModelActivity activity = DiagnosticUtility.ShouldUseActivity ? ServiceModelActivity.CreateActivity(true, SR.GetString(SR.WmiGetObject, string.IsNullOrEmpty(objectPath) ? string.Empty : objectPath), ActivityType.WmiGetObject) : null) { try { ObjectPathRegex objPathRegex = new ObjectPathRegex(objectPath); ParameterContext parms = new ParameterContext(objPathRegex.ClassName, this.wbemServices, wbemContext, wbemSink); WbemInstance wbemInstance = new WbemInstance(parms, objPathRegex); IWmiProvider wmiProvider = this.GetProvider(parms.ClassName); if (wmiProvider.GetInstance(new InstanceContext(wbemInstance))) { wbemInstance.Indicate(); } WbemException.ThrowIfFail(wbemSink.SetStatus( (int)WbemNative.tag_WBEM_STATUS_TYPE.WBEM_STATUS_COMPLETE, (int)WbemNative.WbemStatus.WBEM_S_NO_ERROR, null, null)); } catch (WbemException e) { DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, (ushort)System.Runtime.Diagnostics.EventLogCategory.Wmi, (uint)System.Runtime.Diagnostics.EventLogEventId.WmiGetObjectFailed, TraceUtility.CreateSourceString(this), e.ToString()); wbemSink.SetStatus((int)WbemNative.tag_WBEM_STATUS_TYPE.WBEM_STATUS_COMPLETE, e.ErrorCode, null, null); return(e.ErrorCode); } #pragma warning suppress 56500 // covered by FxCOP catch (Exception e) { DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, (ushort)System.Runtime.Diagnostics.EventLogCategory.Wmi, (uint)System.Runtime.Diagnostics.EventLogEventId.WmiGetObjectFailed, TraceUtility.CreateSourceString(this), e.ToString()); wbemSink.SetStatus((int)WbemNative.tag_WBEM_STATUS_TYPE.WBEM_STATUS_COMPLETE, (int)WbemNative.WbemStatus.WBEM_E_FAILED, null, null); return((int)WbemNative.WbemStatus.WBEM_E_FAILED); } finally { Marshal.ReleaseComObject(wbemSink); } } return((int)WbemNative.WbemStatus.WBEM_S_NO_ERROR); }
public static ServiceModelActivity StartListenAtActivity(MsmqReceiveHelper receiver) { ServiceModelActivity activity = receiver.Activity; if (DiagnosticUtility.ShouldUseActivity && (activity == null)) { activity = ServiceModelActivity.CreateActivity(true); if (FxTrace.Trace != null) { FxTrace.Trace.TraceTransfer(activity.Id); } ServiceModelActivity.Start(activity, System.ServiceModel.SR.GetString("ActivityListenAt", new object[] { receiver.ListenUri.ToString() }), ActivityType.ListenAt); } return(activity); }
public static ServiceModelActivity StartListenAtActivity(MsmqReceiveHelper receiver) { ServiceModelActivity activity = receiver.Activity; if (DiagnosticUtility.ShouldUseActivity && null == activity) { activity = ServiceModelActivity.CreateActivity(true); if (null != FxTrace.Trace) { FxTrace.Trace.TraceTransfer(activity.Id); } ServiceModelActivity.Start(activity, SR.GetString(SR.ActivityListenAt, receiver.ListenUri.ToString()), ActivityType.ListenAt); } return(activity); }
public TracingConnection(IConnection connection, bool inheritCurrentActivity) : base(connection) { this.activity = inheritCurrentActivity ? ServiceModelActivity.CreateActivity(DiagnosticTraceBase.ActivityId, false) : ServiceModelActivity.CreateActivity(); Fx.Assert(this.activity != null, ""); if (DiagnosticUtility.ShouldUseActivity && !inheritCurrentActivity) { if (null != FxTrace.Trace) { FxTrace.Trace.TraceTransfer(this.activity.Id); } } }
internal void Open(TransportChannelListener channelListener) { if (DiagnosticUtility.ShouldUseActivity) { if (this.activity == null) { this.activity = ServiceModelActivity.CreateActivity(true); if (DiagnosticUtility.ShouldUseActivity) { if (null != FxTrace.Trace) { FxTrace.Trace.TraceTransfer(this.Activity.Id); } ServiceModelActivity.Start(this.Activity, SR.GetString(SR.ActivityListenAt, channelListener.Uri.ToString()), ActivityType.ListenAt); } } channelListener.Activity = this.Activity; } using (ServiceModelActivity.BoundOperation(this.Activity)) { if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, TraceCode.TransportListen, SR.GetString(SR.TraceCodeTransportListen, channelListener.Uri.ToString()), this); } this.Register(channelListener); try { lock (ThisLock) { if (openCount == 0) { OnOpen(); } openCount++; } } catch { this.Unregister(channelListener); throw; } } }
internal void Open(TransportChannelListener channelListener) { if (DiagnosticUtility.ShouldUseActivity) { if (this.activity == null) { this.activity = ServiceModelActivity.CreateActivity(true); if (DiagnosticUtility.ShouldUseActivity) { if (FxTrace.Trace != null) { FxTrace.Trace.TraceTransfer(this.Activity.Id); } ServiceModelActivity.Start(this.Activity, System.ServiceModel.SR.GetString("ActivityListenAt", new object[] { channelListener.Uri.ToString() }), ActivityType.ListenAt); } } channelListener.Activity = this.Activity; } using (ServiceModelActivity.BoundOperation(this.Activity)) { if (DiagnosticUtility.ShouldTraceInformation) { TraceUtility.TraceEvent(TraceEventType.Information, 0x80036, System.ServiceModel.SR.GetString("TraceCodeTransportListen", new object[] { channelListener.Uri.ToString() }), this); } this.Register(channelListener); try { lock (this.ThisLock) { if (this.openCount == 0) { this.OnOpen(); } this.openCount++; } } catch { this.Unregister(channelListener); throw; } } }
internal void Open(TimeSpan timeout, Microsoft.ServiceBus.Channels.TransportChannelListener channelListener) { TimeoutHelper timeoutHelper = new TimeoutHelper(timeout); if (DiagnosticUtility.ShouldUseActivity) { if (this.activity == null) { this.activity = ServiceModelActivity.CreateActivity(true); } channelListener.ServiceModelActivity = this.Activity; } using (Microsoft.ServiceBus.Diagnostics.Activity activity = ServiceModelActivity.BoundOperation(this.Activity)) { if (DiagnosticUtility.ShouldTraceInformation) { DiagnosticTrace diagnosticTrace = DiagnosticUtility.DiagnosticTrace; string traceCodeTransportListen = Resources.TraceCodeTransportListen; object[] absoluteUri = new object[] { channelListener.Uri.AbsoluteUri }; diagnosticTrace.TraceEvent(TraceEventType.Information, TraceCode.TransportListen, Microsoft.ServiceBus.SR.GetString(traceCodeTransportListen, absoluteUri), null, null, this); } this.Register(timeoutHelper.RemainingTime(), channelListener); try { lock (this.ThisLock) { if (this.openCount == 0) { this.OnOpen(timeoutHelper.RemainingTime()); } Microsoft.ServiceBus.Channels.TransportManager transportManager = this; transportManager.openCount = transportManager.openCount + 1; } } catch { this.Unregister(timeoutHelper.RemainingTime(), channelListener); throw; } } }
int WbemNative.IWbemServices.GetObjectAsync(string objectPath, int flags, WbemNative.IWbemContext wbemContext, WbemNative.IWbemObjectSink wbemSink) { if (((wbemContext == null) || (wbemSink == null)) || (this.wbemServices == null)) { return(-2147217400); } using (DiagnosticUtility.ShouldUseActivity ? ServiceModelActivity.CreateActivity(true, System.ServiceModel.SR.GetString("WmiGetObject", new object[] { string.IsNullOrEmpty(objectPath) ? string.Empty : objectPath }), ActivityType.WmiGetObject) : null) { try { ObjectPathRegex objPathRegex = new ObjectPathRegex(objectPath); ParameterContext parms = new ParameterContext(objPathRegex.ClassName, this.wbemServices, wbemContext, wbemSink); WbemInstance wbemInstance = new WbemInstance(parms, objPathRegex); if (this.GetProvider(parms.ClassName).GetInstance(new InstanceContext(wbemInstance))) { wbemInstance.Indicate(); } WbemException.ThrowIfFail(wbemSink.SetStatus(0, 0, null, null)); } catch (WbemException exception) { DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, EventLogCategory.Wmi, (EventLogEventId)(-1073610740), new string[] { TraceUtility.CreateSourceString(this), exception.ToString() }); wbemSink.SetStatus(0, exception.ErrorCode, null, null); return(exception.ErrorCode); } catch (Exception exception2) { DiagnosticUtility.EventLog.LogEvent(TraceEventType.Error, EventLogCategory.Wmi, (EventLogEventId)(-1073610740), new string[] { TraceUtility.CreateSourceString(this), exception2.ToString() }); wbemSink.SetStatus(0, -2147217407, null, null); return(-2147217407); } finally { Marshal.ReleaseComObject(wbemSink); } } return(0); }
internal TracingConnectionListener(IConnectionListener listener, string traceStartInfo, bool newActivity) { this.listener = listener; if (newActivity) { this.activity = ServiceModelActivity.CreateActivity(); if (DiagnosticUtility.ShouldUseActivity) { if (null != FxTrace.Trace) { FxTrace.Trace.TraceTransfer(this.activity.Id); } ServiceModelActivity.Start(this.activity, SR.GetString(SR.ActivityListenAt, traceStartInfo), ActivityType.ListenAt); } } else { this.activity = ServiceModelActivity.CreateActivity(DiagnosticTraceBase.ActivityId, false); if (this.activity != null) { this.activity.Name = traceStartInfo; } } }
internal TracingConnectionListener(IConnectionListener listener) { this.listener = listener; this.activity = ServiceModelActivity.CreateActivity(DiagnosticTraceBase.ActivityId, false); }
internal TracingConnectionInitiator(IConnectionInitiator connectionInitiator, bool isClient) { this.connectionInitiator = connectionInitiator; this.activity = ServiceModelActivity.CreateActivity(DiagnosticTrace.ActivityId); this.isClient = isClient; }