/// <summary> /// Starts a new TraceContext scope. /// </summary> /// <returns>The new TraceContext that can be filled in.</returns> public static TraceContext Begin() { var data = (TraceContext)AsyncLocalContext.GetData(_slot); TraceContext context = null; try { context = new TraceContext(data); AsyncLocalContext.SetData(_slot, context); } catch { context.Dispose(); throw; } return(context); }
/// <summary> /// Initializes a new instance of the TraceContext class. /// </summary> /// <param name="baseContext">The base context.</param> private TraceContext(TraceContext baseContext) { _baseContext = baseContext; }