Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,9 @@ internal long TrySNIScopeEnterEvent(string className, [System.Runtime.CompilerSe
{
if (Log.IsSNIScopeEnabled())
{
StringBuilder sb = new StringBuilder(className);
sb.Append(".").Append(memberName).Append(" | SNI | INFO | SCOPE | Entering Scope {0}");
return SNIScopeEnter(sb.ToString());
long scopeId = Interlocked.Increment(ref s_nextSNIScopeId);
WriteEvent(SNIScopeEnterId, $"{className}.{memberName} | SNI | INFO | SCOPE | Entering Scope {scopeId}");
return scopeId;
}
return 0;
}
Expand Down Expand Up @@ -1017,7 +1017,6 @@ internal void BeginExecute(int objectId, string dataSource, string database, str
[Event(EndExecuteEventId, Keywords = Keywords.ExecutionTrace, Task = Tasks.ExecuteCommand, Opcode = EventOpcode.Stop)]
internal void EndExecute(int objectId, int compositestate, int sqlExceptionNumber, string message)
{

WriteEvent(EndExecuteEventId, objectId, compositestate, sqlExceptionNumber, message);
}

Expand Down Expand Up @@ -1130,10 +1129,17 @@ internal static class EventType
private readonly long _scopeId;

public TrySNIEventScope(long scopeID) => _scopeId = scopeID;
public void Dispose() =>
SqlClientEventSource.Log.SNIScopeLeave(string.Format("Exit SNI Scope {0}", _scopeId));
public void Dispose()
{
if (_scopeId == 0)
{
return;
}
SqlClientEventSource.Log.TrySNIScopeLeaveEvent(_scopeId);
}

public static TrySNIEventScope Create(string message) => new TrySNIEventScope(SqlClientEventSource.Log.SNIScopeEnter(message));
public static TrySNIEventScope Create(string className, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
=> new TrySNIEventScope(SqlClientEventSource.Log.TrySNIScopeEnterEvent(className, memberName));
}

internal readonly ref struct TryEventScope //: IDisposable
Expand Down