本文整理汇总了C#中System.Runtime.Diagnostics.EventTraceActivity类的典型用法代码示例。如果您正苦于以下问题:C# EventTraceActivity类的具体用法?C# EventTraceActivity怎么用?C# EventTraceActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventTraceActivity类属于System.Runtime.Diagnostics命名空间,在下文中一共展示了EventTraceActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackingRecord
protected TrackingRecord(Guid instanceId)
{
this.InstanceId = instanceId;
this.EventTime = DateTime.UtcNow;
this.Level = TraceLevel.Info;
this.eventTraceActivity = new EventTraceActivity(instanceId);
}
示例2: WriteEvent
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, Guid value1, string value2, string value3)
{
const int argumentCount = 3;
bool status = true;
//check all strings for null
value2 = (value2 ?? string.Empty);
value3 = (value3 ?? string.Empty);
fixed (char* string1Bytes = value2, string2Bytes = value3)
{
byte* eventData = stackalloc byte[sizeof(UnsafeNativeMethods.EventData) * argumentCount];
UnsafeNativeMethods.EventData* eventDataPtr = (UnsafeNativeMethods.EventData*)eventData;
eventDataPtr[0].DataPointer = (ulong)(&value1);
eventDataPtr[0].Size = (uint)(sizeof(Guid));
eventDataPtr[1].DataPointer = (ulong)string1Bytes;
eventDataPtr[1].Size = (uint)(value2.Length + 1) * sizeof(char);
eventDataPtr[2].DataPointer = (ulong)string2Bytes;
eventDataPtr[2].Size = (uint)(value3.Length + 1) * sizeof(char);
status = WriteEvent(ref eventDescriptor, eventTraceActivity, argumentCount, (IntPtr)(eventData));
}
return status;
}
示例3: ActionItemScheduled
internal static void ActionItemScheduled(EtwDiagnosticTrace trace, EventTraceActivity eventTraceActivity)
{
TracePayload serializedPayload = trace.GetSerializedPayload(null, null, null);
if (TraceCore.IsEtwEventEnabled(trace, 13))
{
TraceCore.WriteEtwEvent(trace, 13, eventTraceActivity, serializedPayload.AppDomainFriendlyName);
}
}
示例4: SqlCommandAsyncResult
public SqlCommandAsyncResult(SqlCommand sqlCommand, string connectionString, EventTraceActivity eventTraceActivity, DependentTransaction dependentTransaction,
TimeSpan timeout, int retryCount, int maximumRetries, AsyncCallback callback, object state)
: base(callback, state)
{
long openTimeout = Math.Min(timeout.Ticks, SqlCommandAsyncResult.MaximumOpenTimeout.Ticks);
this.sqlCommand = sqlCommand;
this.connectionString = connectionString;
this.eventTraceActivity = eventTraceActivity;
this.dependentTransaction = dependentTransaction;
this.timeoutHelper = new TimeoutHelper(TimeSpan.FromTicks(openTimeout));
this.retryCount = retryCount;
this.maximumRetries = maximumRetries;
}
示例5: TryAttachActivity
public static bool TryAttachActivity(Message message, EventTraceActivity activity)
{
if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled && (message != null) && (activity != null))
{
if (!message.Properties.ContainsKey(EventTraceActivity.Name))
{
message.Properties.Add(EventTraceActivity.Name, activity);
return true;
}
}
return false;
}
示例6: InstanceHandle
internal InstanceHandle(InstanceStore store, InstanceOwner owner, Guid instanceId)
{
Fx.Assert(store != null, "Shouldn't be possible here either.");
Fx.Assert(instanceId != Guid.Empty, "Should be validating this.");
Version = -1;
Store = store;
Owner = owner;
Id = instanceId;
View = new InstanceView(owner, instanceId);
IsValid = true;
if (Fx.Trace.IsEtwProviderEnabled)
{
eventTraceActivity = new EventTraceActivity(instanceId);
}
}
示例7: InstancePersistenceContext
internal InstancePersistenceContext(InstanceHandle handle, Transaction transaction)
: this(handle)
{
Fx.Assert(transaction != null, "Null Transaction passed to InstancePersistenceContext.");
// Let's take our own clone of the transaction. We need to do this because we might need to
// create a TransactionScope using the transaction and in cases where we are dealing with a
// transaction that is flowed into the workflow on a message, the DependentTransaction that the
// dispatcher creates and sets to Transaction.Current may already be Completed by the time a
// Save operation is done. And since TransactionScope creates a DependentTransaction, it won't
// be able to.
// We don't create another DependentClone because we are going to do a EnlistVolatile on the
// transaction ourselves.
this.transaction = transaction.Clone();
IsHostTransaction = true;
this.eventTraceActivity = handle.EventTraceActivity;
}
示例8: TryExtractActivity
public static EventTraceActivity TryExtractActivity(Message message, bool createIfNotExist)
{
EventTraceActivity eventTraceActivity = null;
if (message != null && message.State != MessageState.Closed)
{
object property;
if (message.Properties.TryGetValue(EventTraceActivity.Name, out property))
{
eventTraceActivity = property as EventTraceActivity;
}
if (eventTraceActivity == null)
{
Guid activityId;
if (GetMessageId(message, out activityId))
{
eventTraceActivity = new EventTraceActivity(activityId);
}
else
{
UniqueId uid = message.Headers.RelatesTo;
if (uid != null)
{
if (uid.TryGetGuid(out activityId))
{
eventTraceActivity = new EventTraceActivity(activityId);
}
}
}
if (eventTraceActivity == null && createIfNotExist)
{
eventTraceActivity = new EventTraceActivity();
}
if (eventTraceActivity != null)
{
// Attach the trace activity to the message
message.Properties[EventTraceActivity.Name] = eventTraceActivity;
}
}
}
return eventTraceActivity;
}
示例9: WriteEvent
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, Guid value1, string value2, string value3)
{
string str = value2;
string empty = str;
if (str == null)
{
empty = string.Empty;
}
value2 = empty;
string str1 = value3;
string empty1 = str1;
if (str1 == null)
{
empty1 = string.Empty;
}
value3 = empty1;
fixed (string str2 = value2)
{
string* strPointers = &str2;
char* offsetToStringData = (char*)(&str2);
if (&str2 != null)
{
offsetToStringData = (char*)(strPointers + RuntimeHelpers.OffsetToStringData);
}
char* chrPointer = offsetToStringData;
fixed (string str3 = value3)
{
string* strPointers1 = &str3;
char* offsetToStringData1 = (char*)(&str3);
if (&str3 != null)
{
offsetToStringData1 = (char*)(strPointers1 + RuntimeHelpers.OffsetToStringData);
}
byte* length = (byte*)sizeof(UnsafeNativeMethods.EventData) * 3;
(*((UnsafeNativeMethods.EventData*)length)).DataPointer = (ulong)(&value1);
(*((UnsafeNativeMethods.EventData*)length)).Size = sizeof(Guid);
((UnsafeNativeMethods.EventData*)length + sizeof(UnsafeNativeMethods.EventData)).DataPointer = (ulong)chrPointer;
((UnsafeNativeMethods.EventData*)length + sizeof(UnsafeNativeMethods.EventData)).Size = (value2.Length + 1) * 2;
((UnsafeNativeMethods.EventData*)length + 2 * sizeof(UnsafeNativeMethods.EventData)).DataPointer = (ulong)offsetToStringData1;
((UnsafeNativeMethods.EventData*)length + 2 * sizeof(UnsafeNativeMethods.EventData)).Size = (value3.Length + 1) * 2;
bool flag = base.WriteEvent(ref eventDescriptor, eventTraceActivity, 3, (IntPtr)length);
return flag;
}
}
}
示例10: TransportOutputChannel
protected TransportOutputChannel(ChannelManagerBase channelManager, EndpointAddress to, Uri via, bool manualAddressing, MessageVersion messageVersion)
: base(channelManager)
{
_manualAddressing = manualAddressing;
_messageVersion = messageVersion;
_to = to;
_via = via;
if (!manualAddressing && to != null)
{
Uri toUri;
if (to.IsAnonymous)
{
toUri = _messageVersion.Addressing.AnonymousUri;
}
else if (to.IsNone)
{
toUri = _messageVersion.Addressing.NoneUri;
}
else
{
toUri = to.Uri;
}
if (toUri != null)
{
XmlDictionaryString dictionaryTo = new ToDictionary(toUri.AbsoluteUri).To;
_toHeader = ToHeader.Create(toUri, dictionaryTo, messageVersion.Addressing);
}
_anyHeadersToAdd = to.Headers.Count > 0;
}
if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
{
_channelEventTraceActivity = EventTraceActivity.GetFromThreadOrCreate();
}
}
示例11: WriteMessageEvent
public bool WriteMessageEvent(EventTraceActivity eventTraceActivity, string eventMessage)
{
return WriteMessageEvent(eventTraceActivity, eventMessage, 0, 0);
}
示例12: SetOnThread
internal static void SetOnThread(EventTraceActivity eventTraceActivity)
{
if (eventTraceActivity != null)
{
}
}
示例13: WriteEvent
internal protected bool WriteEvent(ref EventDescriptor eventDescriptor, EventTraceActivity eventTraceActivity, int dataCount, IntPtr data)
{
uint status = 0;
if (eventTraceActivity != null)
{
SetActivityId(ref eventTraceActivity.ActivityId);
}
unsafe
{
status = UnsafeNativeMethods.EventWrite(this.traceRegistrationHandle, ref eventDescriptor, (uint)dataCount, (UnsafeNativeMethods.EventData*)data);
}
if (status != 0)
{
SetLastError((int)status);
return false;
}
return true;
}
示例14: CreateContext
internal static HttpRequestContext CreateContext(HttpChannelListener listener, HttpListenerContext listenerContext, EventTraceActivity eventTraceActivity)
{
return new ListenerHttpContext(listener, listenerContext, eventTraceActivity);
}
示例15: TraceHttpMessageReceived
void TraceHttpMessageReceived(Message message)
{
if (FxTrace.Trace.IsEnd2EndActivityTracingEnabled)
{
bool attached = false;
Guid relatedId = this.eventTraceActivity != null ? this.eventTraceActivity.ActivityId : Guid.Empty;
HttpRequestMessageProperty httpProperty;
// Encoder will always add an activity. We need to remove this and read it
// from the web headers for http since correlation might be propogated.
if (message.Headers.MessageId == null &&
message.Properties.TryGetValue<HttpRequestMessageProperty>(HttpRequestMessageProperty.Name, out httpProperty))
{
try
{
string e2eId = httpProperty.Headers[EventTraceActivity.Name];
if (!String.IsNullOrEmpty(e2eId))
{
byte[] data = Convert.FromBase64String(e2eId);
if (data != null && data.Length == 16)
{
Guid id = new Guid(data);
this.eventTraceActivity = new EventTraceActivity(id, true);
message.Properties[EventTraceActivity.Name] = this.eventTraceActivity;
attached = true;
}
}
}
catch (Exception ex)
{
if (Fx.IsFatal(ex))
{
throw;
}
}
}
if (!attached)
{
this.eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message, true);
}
if (TD.MessageReceivedByTransportIsEnabled())
{
TD.MessageReceivedByTransport(
this.eventTraceActivity,
this.listener != null && this.listener.Uri != null ? this.listener.Uri.AbsoluteUri : string.Empty,
relatedId);
}
}
}