using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyTitle("System.Diagnostics.DiagnosticSource")]
[assembly: AssemblyDescription("System.Diagnostics.DiagnosticSource")]
[assembly: AssemblyDefaultAlias("System.Diagnostics.DiagnosticSource")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.24705.01")]
[assembly: AssemblyInformationalVersion("4.6.24705.01. Commit Hash: 4d1af962ca0fede10beb01d197367c2f90e92c97")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyVersion("4.0.1.0")]
namespace System.Diagnostics;

public abstract class DiagnosticSource : Object
{
	public abstract void Write(string name, object value);

	public abstract bool IsEnabled(string name);
}
public class DiagnosticListener : DiagnosticSource, IObservable<KeyValuePair<string, object>>, IDisposable
{
	private class DiagnosticSubscription : Object, IDisposable
	{
		internal IObserver<KeyValuePair<string, object>> Observer;

		internal Predicate<string> IsEnabled;

		internal DiagnosticListener Owner;

		internal DiagnosticSubscription Next;

		public void Dispose()
		{
			DiagnosticSubscription subscriptions;
			DiagnosticSubscription diagnosticSubscription;
			do
			{
				subscriptions = Owner._subscriptions;
				diagnosticSubscription = Remove(subscriptions, this);
			}
			while (Interlocked.CompareExchange<DiagnosticSubscription>(ref Owner._subscriptions, diagnosticSubscription, subscriptions) != subscriptions);
		}

		private static DiagnosticSubscription Remove(DiagnosticSubscription subscriptions, DiagnosticSubscription subscription)
		{
			if (subscriptions == null)
			{
				return null;
			}
			if (subscriptions.Observer == subscription.Observer && (Delegate)(object)subscriptions.IsEnabled == (Delegate)(object)subscription.IsEnabled)
			{
				return subscriptions.Next;
			}
			return new DiagnosticSubscription
			{
				Observer = subscriptions.Observer,
				Owner = subscriptions.Owner,
				IsEnabled = subscriptions.IsEnabled,
				Next = Remove(subscriptions.Next, subscription)
			};
		}
	}

	private class AllListenerObservable : Object, IObservable<DiagnosticListener>
	{
		internal class AllListenerSubscription : Object, IDisposable
		{
			private readonly AllListenerObservable _owner;

			internal readonly IObserver<DiagnosticListener> Subscriber;

			internal AllListenerSubscription Next;

			internal AllListenerSubscription(AllListenerObservable owner, IObserver<DiagnosticListener> subscriber, AllListenerSubscription next)
			{
				_owner = owner;
				Subscriber = subscriber;
				Next = next;
			}

			public void Dispose()
			{
				if (_owner.Remove(this))
				{
					Subscriber.OnCompleted();
				}
			}
		}

		private AllListenerSubscription _subscriptions;

		public IDisposable Subscribe(IObserver<DiagnosticListener> observer)
		{
			lock (s_lock)
			{
				for (DiagnosticListener diagnosticListener = s_allListeners; diagnosticListener != null; diagnosticListener = diagnosticListener._next)
				{
					observer.OnNext(diagnosticListener);
				}
				_subscriptions = new AllListenerSubscription(this, observer, _subscriptions);
				return (IDisposable)(object)_subscriptions;
			}
		}

		internal void OnNewDiagnosticListener(DiagnosticListener diagnosticListener)
		{
			for (AllListenerSubscription allListenerSubscription = _subscriptions; allListenerSubscription != null; allListenerSubscription = allListenerSubscription.Next)
			{
				allListenerSubscription.Subscriber.OnNext(diagnosticListener);
			}
		}

		private bool Remove(AllListenerSubscription subscription)
		{
			lock (s_lock)
			{
				if (_subscriptions == subscription)
				{
					_subscriptions = subscription.Next;
					return true;
				}
				if (_subscriptions != null)
				{
					AllListenerSubscription allListenerSubscription = _subscriptions;
					while (allListenerSubscription.Next != null)
					{
						if (allListenerSubscription.Next == subscription)
						{
							allListenerSubscription.Next = allListenerSubscription.Next.Next;
							return true;
						}
						allListenerSubscription = allListenerSubscription.Next;
					}
				}
				return false;
			}
		}
	}

	private volatile DiagnosticSubscription _subscriptions;

	private DiagnosticListener _next;

	private bool _disposed;

	private static DiagnosticListener s_allListeners;

	private static AllListenerObservable s_allListenerObservable;

	private static object s_lock = (object)new Object();

	public static IObservable<DiagnosticListener> AllListeners
	{
		get
		{
			if (s_allListenerObservable == null)
			{
				s_allListenerObservable = new AllListenerObservable();
			}
			return s_allListenerObservable;
		}
	}

	[field: CompilerGenerated]
	public string Name
	{
		[CompilerGenerated]
		get;
		[CompilerGenerated]
		private set;
	}

	public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer, Predicate<string> isEnabled)
	{
		if (_disposed)
		{
			return (IDisposable)(object)new DiagnosticSubscription
			{
				Owner = this
			};
		}
		DiagnosticSubscription diagnosticSubscription = new DiagnosticSubscription
		{
			Observer = observer,
			IsEnabled = isEnabled,
			Owner = this,
			Next = _subscriptions
		};
		while (Interlocked.CompareExchange<DiagnosticSubscription>(ref _subscriptions, diagnosticSubscription, diagnosticSubscription.Next) != diagnosticSubscription.Next)
		{
			diagnosticSubscription.Next = _subscriptions;
		}
		return (IDisposable)(object)diagnosticSubscription;
	}

	public IDisposable Subscribe(IObserver<KeyValuePair<string, object>> observer)
	{
		return Subscribe(observer, null);
	}

	public DiagnosticListener(string name)
	{
		Name = name;
		lock (s_lock)
		{
			s_allListenerObservable?.OnNewDiagnosticListener(this);
			_next = s_allListeners;
			s_allListeners = this;
		}
		((EventSource)DiagnosticSourceEventSource.Logger).IsEnabled();
	}

	public virtual void Dispose()
	{
		lock (s_lock)
		{
			if (_disposed)
			{
				return;
			}
			_disposed = true;
			if (s_allListeners == this)
			{
				s_allListeners = s_allListeners._next;
			}
			else
			{
				for (DiagnosticListener next = s_allListeners; next != null; next = next._next)
				{
					if (next._next == this)
					{
						next._next = _next;
						break;
					}
				}
			}
			_next = null;
		}
		DiagnosticSubscription diagnosticSubscription = null;
		Interlocked.Exchange<DiagnosticSubscription>(ref diagnosticSubscription, _subscriptions);
		while (diagnosticSubscription != null)
		{
			diagnosticSubscription.Observer.OnCompleted();
			diagnosticSubscription = diagnosticSubscription.Next;
		}
	}

	public override string ToString()
	{
		return Name;
	}

	public override bool IsEnabled(string name)
	{
		for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
		{
			if (diagnosticSubscription.IsEnabled == null || diagnosticSubscription.IsEnabled.Invoke(name))
			{
				return true;
			}
		}
		return false;
	}

	public override void Write(string name, object value)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
		{
			diagnosticSubscription.Observer.OnNext(new KeyValuePair<string, object>(name, value));
		}
	}
}
[EventSource(Name = "Microsoft-Diagnostics-DiagnosticSource")]
internal class DiagnosticSourceEventSource : EventSource
{
	public class Keywords : Object
	{
		public const EventKeywords Messages = (EventKeywords)1L;

		public const EventKeywords Events = (EventKeywords)2L;

		public const EventKeywords IgnoreShortCutKeywords = (EventKeywords)2048L;

		public const EventKeywords AspNetCoreHosting = (EventKeywords)4096L;

		public const EventKeywords EntityFrameworkCoreCommands = (EventKeywords)8192L;
	}

	internal class FilterAndTransform : Object
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0 : Object
		{
			public string listenerNameFilter;

			public string eventNameFilter;

			public Action<string, string, IEnumerable<KeyValuePair<string, string>>> writeEvent;

			public FilterAndTransform <>4__this;

			internal void <.ctor>b__0(DiagnosticListener newListener)
			{
				<>c__DisplayClass2_1 CS$<>8__locals8 = new <>c__DisplayClass2_1
				{
					CS$<>8__locals1 = this,
					newListener = newListener
				};
				if (listenerNameFilter != null && !(listenerNameFilter == CS$<>8__locals8.newListener.Name))
				{
					return;
				}
				<>4__this._eventSource.NewDiagnosticListener(CS$<>8__locals8.newListener.Name);
				Predicate<string> isEnabled = null;
				if (eventNameFilter != null)
				{
					isEnabled = (string eventName) => eventNameFilter == eventName;
				}
				IDisposable subscription = CS$<>8__locals8.newListener.Subscribe(new CallbackObserver<KeyValuePair<string, object>>(delegate(KeyValuePair<string, object> evnt)
				{
					if (CS$<>8__locals8.CS$<>8__locals1.eventNameFilter == null || !(CS$<>8__locals8.CS$<>8__locals1.eventNameFilter != evnt.Key))
					{
						List<KeyValuePair<string, string>> val = CS$<>8__locals8.CS$<>8__locals1.<>4__this.Morph(evnt.Value);
						string key = evnt.Key;
						CS$<>8__locals8.CS$<>8__locals1.writeEvent.Invoke(CS$<>8__locals8.newListener.Name, key, (IEnumerable<KeyValuePair<string, string>>)(object)val);
					}
				}), isEnabled);
				<>4__this._liveSubscriptions = new Subscriptions(subscription, <>4__this._liveSubscriptions);
			}

			internal bool <.ctor>b__1(string eventName)
			{
				return eventNameFilter == eventName;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_1 : Object
		{
			public DiagnosticListener newListener;

			public <>c__DisplayClass2_0 CS$<>8__locals1;

			internal void <.ctor>b__2(KeyValuePair<string, object> evnt)
			{
				if (CS$<>8__locals1.eventNameFilter == null || !(CS$<>8__locals1.eventNameFilter != evnt.Key))
				{
					List<KeyValuePair<string, string>> val = CS$<>8__locals1.<>4__this.Morph(evnt.Value);
					string key = evnt.Key;
					CS$<>8__locals1.writeEvent.Invoke(newListener.Name, key, (IEnumerable<KeyValuePair<string, string>>)(object)val);
				}
			}
		}

		public FilterAndTransform Next;

		private IDisposable _diagnosticsListenersSubscription;

		private Subscriptions _liveSubscriptions;

		private bool _noImplicitTransforms;

		private Type _expectedArgType;

		private TransformSpec _implicitTransforms;

		private TransformSpec _explicitTransforms;

		private DiagnosticSourceEventSource _eventSource;

		public static void CreateFilterAndTransformList(ref FilterAndTransform specList, string filterAndPayloadSpecs, DiagnosticSourceEventSource eventSource)
		{
			DestroyFilterAndTransformList(ref specList);
			if (filterAndPayloadSpecs == null)
			{
				filterAndPayloadSpecs = "";
			}
			int num = filterAndPayloadSpecs.Length;
			while (true)
			{
				if (0 < num && Char.IsWhiteSpace(filterAndPayloadSpecs[num - 1]))
				{
					num--;
					continue;
				}
				int num2 = filterAndPayloadSpecs.LastIndexOf('\n', num - 1, num);
				int i = 0;
				if (0 <= num2)
				{
					i = num2 + 1;
				}
				for (; i < num && Char.IsWhiteSpace(filterAndPayloadSpecs[i]); i++)
				{
				}
				specList = new FilterAndTransform(filterAndPayloadSpecs, i, num, eventSource, specList);
				num = num2;
				if (num < 0)
				{
					break;
				}
			}
		}

		public static void DestroyFilterAndTransformList(ref FilterAndTransform specList)
		{
			FilterAndTransform filterAndTransform = specList;
			specList = null;
			while (filterAndTransform != null)
			{
				filterAndTransform.Dispose();
				filterAndTransform = filterAndTransform.Next;
			}
		}

		public FilterAndTransform(string filterAndPayloadSpec, int startIdx, int endIdx, DiagnosticSourceEventSource eventSource, FilterAndTransform next)
		{
			<>c__DisplayClass2_0 CS$<>8__locals25 = new <>c__DisplayClass2_0
			{
				<>4__this = this
			};
			Next = next;
			_eventSource = eventSource;
			CS$<>8__locals25.listenerNameFilter = null;
			CS$<>8__locals25.eventNameFilter = null;
			string text = null;
			int num = startIdx;
			int num2 = endIdx;
			int num3 = filterAndPayloadSpec.IndexOf(':', startIdx, endIdx - startIdx);
			if (0 <= num3)
			{
				num2 = num3;
				num = num3 + 1;
			}
			int num4 = filterAndPayloadSpec.IndexOf('/', startIdx, num2 - startIdx);
			if (0 <= num4)
			{
				CS$<>8__locals25.listenerNameFilter = filterAndPayloadSpec.Substring(startIdx, num4 - startIdx);
				int num5 = filterAndPayloadSpec.IndexOf('@', num4 + 1, num2 - num4 - 1);
				if (0 <= num5)
				{
					text = filterAndPayloadSpec.Substring(num5 + 1, num2 - num5 - 1);
					CS$<>8__locals25.eventNameFilter = filterAndPayloadSpec.Substring(num4 + 1, num5 - num4 - 1);
				}
				else
				{
					CS$<>8__locals25.eventNameFilter = filterAndPayloadSpec.Substring(num4 + 1, num2 - num4 - 1);
				}
			}
			else if (startIdx < num2)
			{
				CS$<>8__locals25.listenerNameFilter = filterAndPayloadSpec.Substring(startIdx, num2 - startIdx);
			}
			_eventSource.Message(String.Concat((string[])(object)new String[5]
			{
				"DiagnosticSource: Enabling '",
				CS$<>8__locals25.listenerNameFilter ?? "*",
				"/",
				CS$<>8__locals25.eventNameFilter ?? "*",
				"'"
			}));
			if (num < endIdx && filterAndPayloadSpec[num] == '-')
			{
				_eventSource.Message("DiagnosticSource: suppressing implicit transforms.");
				_noImplicitTransforms = true;
				num++;
			}
			if (num < endIdx)
			{
				while (true)
				{
					int num6 = num;
					int num7 = filterAndPayloadSpec.LastIndexOf(';', endIdx - 1, endIdx - num);
					if (0 <= num7)
					{
						num6 = num7 + 1;
					}
					if (num6 < endIdx)
					{
						if (((EventSource)_eventSource).IsEnabled((EventLevel)4, (EventKeywords)1))
						{
							_eventSource.Message(String.Concat("DiagnosticSource: Parsing Explicit Transform '", filterAndPayloadSpec.Substring(num6, endIdx - num6), "'"));
						}
						_explicitTransforms = new TransformSpec(filterAndPayloadSpec, num6, endIdx, _explicitTransforms);
					}
					if (num == num6)
					{
						break;
					}
					endIdx = num7;
				}
			}
			CS$<>8__locals25.writeEvent = null;
			if (text != null && text.Contains("Activity"))
			{
				MethodInfo declaredMethod = IntrospectionExtensions.GetTypeInfo(typeof(DiagnosticSourceEventSource)).GetDeclaredMethod(text);
				if (declaredMethod != null)
				{
					try
					{
						CS$<>8__locals25.writeEvent = (Action<string, string, IEnumerable<KeyValuePair<string, string>>>)(object)declaredMethod.CreateDelegate(typeof(Action<string, string, IEnumerable<KeyValuePair<string, string>>>), (object)_eventSource);
					}
					catch (Exception)
					{
					}
				}
				if (CS$<>8__locals25.writeEvent == null)
				{
					_eventSource.Message(String.Concat("DiagnosticSource: Could not find Event to log Activity ", text));
				}
			}
			if (CS$<>8__locals25.writeEvent == null)
			{
				CS$<>8__locals25.writeEvent = _eventSource.Event;
			}
			_diagnosticsListenersSubscription = DiagnosticListener.AllListeners.Subscribe((IObserver<DiagnosticListener>)new CallbackObserver<DiagnosticListener>(delegate(DiagnosticListener newListener)
			{
				<>c__DisplayClass2_1 CS$<>8__locals30 = new <>c__DisplayClass2_1
				{
					CS$<>8__locals1 = CS$<>8__locals25,
					newListener = newListener
				};
				if (CS$<>8__locals25.listenerNameFilter == null || CS$<>8__locals25.listenerNameFilter == CS$<>8__locals30.newListener.Name)
				{
					CS$<>8__locals25.<>4__this._eventSource.NewDiagnosticListener(CS$<>8__locals30.newListener.Name);
					Predicate<string> isEnabled = null;
					if (CS$<>8__locals25.eventNameFilter != null)
					{
						isEnabled = (string eventName) => CS$<>8__locals25.eventNameFilter == eventName;
					}
					IDisposable subscription = CS$<>8__locals30.newListener.Subscribe(new CallbackObserver<KeyValuePair<string, object>>(delegate(KeyValuePair<string, object> evnt)
					{
						if (CS$<>8__locals30.CS$<>8__locals1.eventNameFilter == null || !(CS$<>8__locals30.CS$<>8__locals1.eventNameFilter != evnt.Key))
						{
							List<KeyValuePair<string, string>> val = CS$<>8__locals30.CS$<>8__locals1.<>4__this.Morph(evnt.Value);
							string key = evnt.Key;
							CS$<>8__locals30.CS$<>8__locals1.writeEvent.Invoke(CS$<>8__locals30.newListener.Name, key, (IEnumerable<KeyValuePair<string, string>>)(object)val);
						}
					}), isEnabled);
					CS$<>8__locals25.<>4__this._liveSubscriptions = new Subscriptions(subscription, CS$<>8__locals25.<>4__this._liveSubscriptions);
				}
			}));
		}

		private void Dispose()
		{
			if (_diagnosticsListenersSubscription != null)
			{
				_diagnosticsListenersSubscription.Dispose();
				_diagnosticsListenersSubscription = null;
			}
			if (_liveSubscriptions != null)
			{
				Subscriptions subscriptions = _liveSubscriptions;
				_liveSubscriptions = null;
				while (subscriptions != null)
				{
					subscriptions.Subscription.Dispose();
					subscriptions = subscriptions.Next;
				}
			}
		}

		public List<KeyValuePair<string, string>> Morph(object args)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			List<KeyValuePair<string, string>> val = new List<KeyValuePair<string, string>>();
			if (args != null)
			{
				if (!_noImplicitTransforms)
				{
					Type type = args.GetType();
					if (_expectedArgType != type)
					{
						_implicitTransforms = null;
						TransformSpec transformSpec = null;
						TypeInfo typeInfo = IntrospectionExtensions.GetTypeInfo(type);
						IEnumerator<PropertyInfo> enumerator = typeInfo.DeclaredProperties.GetEnumerator();
						try
						{
							while (((IEnumerator)enumerator).MoveNext())
							{
								PropertyInfo current = enumerator.Current;
								Type propertyType = current.PropertyType;
								if (propertyType == typeof(String) || IntrospectionExtensions.GetTypeInfo(propertyType).IsPrimitive)
								{
									transformSpec = new TransformSpec(((MemberInfo)current).Name, 0, ((MemberInfo)current).Name.Length, transformSpec);
								}
							}
						}
						finally
						{
							if (enumerator != null)
							{
								((IDisposable)enumerator).Dispose();
							}
						}
						_expectedArgType = type;
						_implicitTransforms = Reverse(transformSpec);
					}
					if (_implicitTransforms != null)
					{
						for (TransformSpec transformSpec2 = _implicitTransforms; transformSpec2 != null; transformSpec2 = transformSpec2.Next)
						{
							val.Add(transformSpec2.Morph(args));
						}
					}
				}
				if (_explicitTransforms != null)
				{
					for (TransformSpec transformSpec3 = _explicitTransforms; transformSpec3 != null; transformSpec3 = transformSpec3.Next)
					{
						KeyValuePair<string, string> val2 = transformSpec3.Morph(args);
						if (val2.Value != null)
						{
							val.Add(val2);
						}
					}
				}
			}
			return val;
		}

		private static TransformSpec Reverse(TransformSpec list)
		{
			TransformSpec transformSpec = null;
			while (list != null)
			{
				TransformSpec next = list.Next;
				list.Next = transformSpec;
				transformSpec = list;
				list = next;
			}
			return transformSpec;
		}
	}

	internal class TransformSpec : Object
	{
		internal class PropertySpec : Object
		{
			private class PropertyFetch : Object
			{
				private class TypedFetchProperty<TObject, TProperty> : PropertyFetch
				{
					private readonly Func<TObject, TProperty> _propertyFetch;

					public TypedFetchProperty(PropertyInfo property)
					{
						_propertyFetch = (Func<TObject, TProperty>)(object)property.GetMethod.CreateDelegate(typeof(Func<TObject, TProperty>));
					}

					public override object Fetch(object obj)
					{
						return _propertyFetch.Invoke((TObject)obj);
					}
				}

				public static PropertyFetch FetcherForProperty(PropertyInfo propertyInfo)
				{
					if (propertyInfo == null)
					{
						return new PropertyFetch();
					}
					Type typeFromHandle = typeof(TypedFetchProperty<, >);
					Type val = IntrospectionExtensions.GetTypeInfo(typeFromHandle).MakeGenericType((Type[])(object)new Type[2]
					{
						((MemberInfo)propertyInfo).DeclaringType,
						propertyInfo.PropertyType
					});
					return (PropertyFetch)Activator.CreateInstance(val, (object[])(object)new Object[1] { (Object)propertyInfo });
				}

				public virtual object Fetch(object obj)
				{
					return null;
				}
			}

			public PropertySpec Next;

			private string _propertyName;

			private Type _expectedType;

			private PropertyFetch _fetchForExpectedType;

			public PropertySpec(string propertyName, PropertySpec next = null)
			{
				Next = next;
				_propertyName = propertyName;
			}

			public object Fetch(object obj)
			{
				Type type = obj.GetType();
				if (type != _expectedType)
				{
					TypeInfo typeInfo = IntrospectionExtensions.GetTypeInfo(type);
					_fetchForExpectedType = PropertyFetch.FetcherForProperty(typeInfo.GetDeclaredProperty(_propertyName));
					_expectedType = type;
				}
				return _fetchForExpectedType.Fetch(obj);
			}
		}

		public TransformSpec Next;

		private string _outputName;

		private PropertySpec _fetches;

		public TransformSpec(string transformSpec, int startIdx, int endIdx, TransformSpec next = null)
		{
			Next = next;
			int num = transformSpec.IndexOf('=', startIdx, endIdx - startIdx);
			if (0 <= num)
			{
				_outputName = transformSpec.Substring(startIdx, num - startIdx);
				startIdx = num + 1;
			}
			while (startIdx < endIdx)
			{
				int num2 = transformSpec.LastIndexOf('.', endIdx - 1, endIdx - startIdx);
				int num3 = startIdx;
				if (0 <= num2)
				{
					num3 = num2 + 1;
				}
				string text = transformSpec.Substring(num3, endIdx - num3);
				_fetches = new PropertySpec(text, _fetches);
				if (_outputName == null)
				{
					_outputName = text;
				}
				endIdx = num2;
			}
		}

		public KeyValuePair<string, string> Morph(object obj)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			for (PropertySpec propertySpec = _fetches; propertySpec != null; propertySpec = propertySpec.Next)
			{
				if (obj != null)
				{
					obj = propertySpec.Fetch(obj);
				}
			}
			return new KeyValuePair<string, string>(_outputName, (obj != null) ? obj.ToString() : null);
		}
	}

	internal class CallbackObserver<T> : Object, IObserver<T>
	{
		private Action<T> _callback;

		public CallbackObserver(Action<T> callback)
		{
			_callback = callback;
		}

		public void OnCompleted()
		{
		}

		public void OnError(Exception error)
		{
		}

		public void OnNext(T value)
		{
			_callback.Invoke(value);
		}
	}

	internal class Subscriptions : Object
	{
		public IDisposable Subscription;

		public Subscriptions Next;

		public Subscriptions(IDisposable subscription, Subscriptions next)
		{
			Subscription = subscription;
			Next = next;
		}
	}

	public static DiagnosticSourceEventSource Logger = new DiagnosticSourceEventSource();

	private readonly string AspNetCoreHostingKeywordValue = "Microsoft.AspNetCore/Microsoft.AspNetCore.Hosting.BeginRequest@Activity1Start:-httpContext.Request.Method;httpContext.Request.Host;httpContext.Request.Path;httpContext.Request.QueryString\nMicrosoft.AspNetCore/Microsoft.AspNetCore.Hosting.EndRequest@Activity1Stop:-";

	private readonly string EntityFrameworkCoreCommandsKeywordValue = "Microsoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.BeforeExecuteCommand@Activity2Start:-Command.Connection.DataSource;Command.Connection.Database;Command.CommandText\nMicrosoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.AfterExecuteCommand@Activity2Stop:-";

	private volatile bool _false;

	private FilterAndTransform _specs;

	[Event(/*Could not decode attribute arguments.*/)]
	public void Message(string Message)
	{
		((EventSource)this).WriteEvent(1, Message);
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void Event(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(2, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void EventJson(string SourceName, string EventName, string ArgmentsJson)
	{
		((EventSource)this).WriteEvent(3, SourceName, EventName, ArgmentsJson);
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void Activity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(4, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void Activity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(5, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void Activity2Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(6, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void Activity2Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(7, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void RecursiveActivity1Start(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(8, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void RecursiveActivity1Stop(string SourceName, string EventName, IEnumerable<KeyValuePair<string, string>> Arguments)
	{
		((EventSource)this).WriteEvent(9, (object[])(object)new Object[3]
		{
			(Object)SourceName,
			(Object)EventName,
			(Object)Arguments
		});
	}

	[Event(/*Could not decode attribute arguments.*/)]
	private void NewDiagnosticListener(string SourceName)
	{
		((EventSource)this).WriteEvent(10, SourceName);
	}

	private DiagnosticSourceEventSource()
		: base((EventSourceSettings)8)
	{
	}

	[NonEvent]
	protected override void OnEventCommand(EventCommandEventArgs command)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Invalid comparison between Unknown and I4
		BreakPointWithDebuggerFuncEval();
		lock (this)
		{
			if (((int)command.Command == 0 || (int)command.Command == -2) && ((EventSource)this).IsEnabled((EventLevel)4, (EventKeywords)2))
			{
				string text = default(string);
				command.Arguments.TryGetValue("FilterAndPayloadSpecs", ref text);
				if (!((EventSource)this).IsEnabled((EventLevel)4, (EventKeywords)2048))
				{
					if (((EventSource)this).IsEnabled((EventLevel)4, (EventKeywords)4096))
					{
						text = NewLineSeparate(text, AspNetCoreHostingKeywordValue);
					}
					if (((EventSource)this).IsEnabled((EventLevel)4, (EventKeywords)8192))
					{
						text = NewLineSeparate(text, EntityFrameworkCoreCommandsKeywordValue);
					}
				}
				FilterAndTransform.CreateFilterAndTransformList(ref _specs, text, this);
			}
			else if ((int)command.Command == 0 || (int)command.Command == -3)
			{
				FilterAndTransform.DestroyFilterAndTransformList(ref _specs);
			}
		}
	}

	private static string NewLineSeparate(string str1, string str2)
	{
		if (String.IsNullOrEmpty(str1))
		{
			return str2;
		}
		return String.Concat(str1, "\n", str2);
	}

	[MethodImpl((MethodImplOptions)72)]
	[NonEvent]
	private void BreakPointWithDebuggerFuncEval()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		new Object();
		while (_false)
		{
			_false = false;
		}
	}
}
