Skip to content

Commit d561432

Browse files
authored
Fix bug in ETW trace code for AcquiredAppLock (#292)
1 parent 7843abe commit d561432

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

src/DurableTask.SqlServer/Logging/DefaultEventSource.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,14 @@ public void AcquiredAppLock(
6161
string AppName,
6262
string ExtensionVersion)
6363
{
64-
this.AcquiredAppLockCore(
64+
this.WriteEvent(
6565
EventIds.AcquiredAppLock,
6666
StatusCode,
6767
LatencyMs,
6868
AppName,
6969
ExtensionVersion);
7070
}
7171

72-
[NonEvent]
73-
unsafe void AcquiredAppLockCore(int eventId, int statusCode, long latencyMs, string appName, string extensionVersion)
74-
{
75-
// This needs to be done manually because the built-in WriteEvent(int, long, long) overload will overwrite data (as shown in testing)
76-
fixed (char* appNamePtr = appName)
77-
fixed (char* extensionVersionPtr = extensionVersion)
78-
{
79-
EventData* data = stackalloc EventData[4];
80-
data[0].DataPointer = (IntPtr)(&statusCode);
81-
data[0].Size = sizeof(int);
82-
data[1].DataPointer = (IntPtr)(&latencyMs);
83-
data[1].Size = sizeof(long);
84-
data[2].DataPointer = (IntPtr)appNamePtr;
85-
data[2].Size = (appName.Length + 1) + 2;
86-
data[3].DataPointer = (IntPtr)extensionVersionPtr;
87-
data[3].Size = (extensionVersion.Length + 1) + 2;
88-
89-
this.WriteEventCore(eventId, 2, data);
90-
}
91-
}
92-
9372
[Event(EventIds.CheckpointStarting, Level = EventLevel.Informational)]
9473
public void CheckpointStarting(
9574
string Name,

0 commit comments

Comments
 (0)