Example #1
0
		/// <summary>
		/// Starts a new TraceContext scope.
		/// </summary>
		/// <returns>The new TraceContext that can be filled in.</returns>
		public static TraceContext Begin()
		{
			var data = (TraceContext)CallContext.LogicalGetData(_slot);
			TraceContext context = null;
			try
			{
				context = new TraceContext(data);
				CallContext.LogicalSetData(_slot, context);
			}
			catch
			{
				context.Dispose();
				throw;
			}

			return context;
		}
Example #2
0
        /// <summary>
        /// Starts a new TraceContext scope.
        /// </summary>
        /// <returns>The new TraceContext that can be filled in.</returns>
        public static TraceContext Begin()
        {
            var          data    = (TraceContext)CallContext.LogicalGetData(_slot);
            TraceContext context = null;

            try
            {
                context = new TraceContext(data);
                CallContext.LogicalSetData(_slot, context);
            }
            catch
            {
                context.Dispose();
                throw;
            }

            return(context);
        }
 public void Dispose()
 {
     context?.Dispose();
 }