12[
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2113:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate because the nested type OverrideEventProvider's base type EventProvider defines a delegate. This includes Delegate and MulticastDelegate methods which require unreferenced code, but EnsureDescriptorsInitialized does not access these members and is safe to call.")]
13[
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2115:ReflectionToDynamicallyAccessedMembers", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate because the nested type OverrideEventProvider's base type EventProvider defines a delegate. This includes Delegate and MulticastDelegate methods which have dynamically accessed members requirements, but EnsureDescriptorsInitialized does not access these members and is safe to call.")]
112 eventSource._activityListener =
null;
113 eventSource._activitySourceSpecs =
null;
154 else if (startIdx <
num2)
191 if (
text !=
null &&
text.Contains(
"Activity"))
216 filterAndTransform._eventSource.NewDiagnosticListener(newListener.Name);
217 Predicate<string> isEnabled = null;
218 if (eventNameFilter != null)
220 isEnabled = (string eventName) => eventNameFilter == eventName;
225 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"DiagnosticSource.Write is marked with RequiresUnreferencedCode.")]
240 _eventSource = eventSource;
241 Next = _eventSource._activitySourceSpecs;
242 _eventSource._activitySourceSpecs =
this;
254 _eventSource.Message(
"DiagnosticSource: suppressing implicit transforms.");
255 _noImplicitTransforms =
true;
331 if (
span2.Length > 0)
407 return Sample(activityOptions.Source.Name, activityOptions.Name, eventSource);
411 return Sample(activityOptions.Source.Name, activityOptions.Name, eventSource);
426 OnActivityStarted(eventSource,
activity);
430 OnActivityStopped(eventSource,
activity);
441 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Activity's properties are being preserved with the DynamicDependencies on OnActivityStarted.")]
454 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Activity's properties are being preserved with the DynamicDependencies on OnActivityStarted.")]
502 filterAndTransform5.Next =
null;
509 if (_diagnosticsListenersSubscription !=
null)
511 _diagnosticsListenersSubscription.Dispose();
512 _diagnosticsListenersSubscription =
null;
514 if (_liveSubscriptions !=
null)
517 _liveSubscriptions =
null;
526 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2112:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
533 if (!_noImplicitTransforms)
553 if (_implicitTransformsTable ==
null)
567 if (_explicitTransforms !=
null)
572 if (
item.Value !=
null)
580 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"The Morph method has RequiresUnreferencedCode, but the trimmer can't see through lamdba calls.")]
587 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2112:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
596 if (!(propertyInfo.
GetMethod ==
null) && propertyInfo.
GetMethod.GetParameters().Length == 0)
641 public override object Fetch(
object obj)
659 public override object Fetch(
object obj)
673 public override object Fetch(
object obj)
686 public override object Fetch(
object obj)
699 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2112:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
725 Log.Message(
$"*Enumerate applied to non-enumerable type {type}");
729 if (propertyInfo ==
null)
741 if (propertyInfo ==
null)
743 Log.Message(
$"Property {propertyName} not found on {type}. Ensure the name is spelled correctly. If you published the application with PublishTrimmed=true, ensure the property was not trimmed away.");
757 Log.Message(
"Property " +
propertyName +
" is static.");
761 public virtual object Fetch(
object obj)
773 public bool IsStatic {
get;
private set; }
779 if (_propertyName ==
"*Activity")
785 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2112:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
795 object result =
null;
802 Log.Message(
$"Property {type}.{_propertyName} threw the exception {value}");
820 _outputName =
transformSpec.Substring(startIdx, num - startIdx);
833 if (_outputName ==
null)
841 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2112:ReflectionToRequiresUnreferencedCode", Justification =
"In EventSource, EnsureDescriptorsInitialized's use of GetType preserves this method which requires unreferenced code, but EnsureDescriptorsInitialized does not access this member and is safe to call.")]
862 _callback = callback;
894 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:-httpContext.TraceIdentifier;httpContext.Response.StatusCode";
896 private readonly
string EntityFrameworkCoreCommandsKeywordValue =
"Microsoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.BeforeExecuteCommand@Activity2Start:-Command.Connection.DataSource;Command.Connection.Database;Command.CommandText\nMicrosoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.AfterExecuteCommand@Activity2Stop:-";
909 WriteEvent(1, Message);
912 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
916 WriteEvent(2, SourceName, EventName, Arguments);
919 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
923 WriteEvent(4, SourceName, EventName, Arguments);
926 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
930 WriteEvent(5, SourceName, EventName, Arguments);
933 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
937 WriteEvent(6, SourceName, EventName, Arguments);
940 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
944 WriteEvent(7, SourceName, EventName, Arguments);
947 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
951 WriteEvent(8, SourceName, EventName, Arguments);
954 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
958 WriteEvent(9, SourceName, EventName, Arguments);
964 WriteEvent(10, SourceName);
967 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
971 WriteEvent(11, SourceName, ActivityName, Arguments);
974 [
UnconditionalSuppressMessage(
"ReflectionAnalysis",
"IL2026:RequiresUnreferencedCode", Justification =
"Arguments parameter is trimmer safe")]
978 WriteEvent(12, SourceName, ActivityName, Arguments);
989 BreakPointWithDebuggerFuncEval();
1000 value = NewLineSeparate(
value, AspNetCoreHostingKeywordValue);
1004 value = NewLineSeparate(
value, EntityFrameworkCoreCommandsKeywordValue);
1018 if (
string.IsNullOrEmpty(
str1))
static ? object CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static void AddActivityListener(ActivityListener listener)
static ? Activity Current
static IObservable< DiagnosticListener > AllListeners
void OnError(Exception error)
readonly Action< T > _callback
CallbackObserver(Action< T > callback)
const EventKeywords AspNetCoreHosting
const EventKeywords EntityFrameworkCoreCommands
const EventKeywords IgnoreShortCutKeywords
const EventKeywords Messages
Subscriptions(IDisposable subscription, Subscriptions next)
void RecursiveActivity1Start(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
FilterAndTransform _activitySourceSpecs
FilterAndTransform _specs
void ActivityStart(string SourceName, string ActivityName, IEnumerable< KeyValuePair< string, string > > Arguments)
void RecursiveActivity1Stop(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
void Activity2Stop(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
void Message(string Message)
ActivityListener _activityListener
DiagnosticSourceEventSource()
void Activity2Start(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
void Activity1Start(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
void Event(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
void BreakPointWithDebuggerFuncEval()
void ActivityStop(string SourceName, string ActivityName, IEnumerable< KeyValuePair< string, string > > Arguments)
override void OnEventCommand(EventCommandEventArgs command)
static string NewLineSeparate(string str1, string str2)
void NewDiagnosticListener(string SourceName)
void Activity1Stop(string SourceName, string EventName, IEnumerable< KeyValuePair< string, string > > Arguments)
static bool Equals(this ReadOnlySpan< char > span, ReadOnlySpan< char > other, StringComparison comparisonType)
virtual ? MethodInfo GetMethod
virtual ? MethodInfo SetMethod
TypeInfo IReflectableType. GetTypeInfo()
virtual ? PropertyInfo GetDeclaredProperty(string name)
static int CompareExchange(ref int location1, int value, int comparand)
PropertyInfo[] GetProperties()
DynamicallyAccessedMemberTypes
@ EtwSelfDescribingEventFormat