// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Diagnostics.Tracing;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
asm is System.Reflection.Emit.AssemblyBuilder ab ? ab.InternalAssembly :
null;
}
+
+ // Assembly load runtime activity name
+ private const string AssemblyLoadName = "AssemblyLoad";
+
+ /// <summary>
+ /// Called by the runtime to start an assembly load activity for tracing
+ /// </summary>
+ private static void StartAssemblyLoad(ref Guid activityId, ref Guid relatedActivityId)
+ {
+ ActivityTracker.Instance.OnStart(NativeRuntimeEventSource.Log.Name, AssemblyLoadName, 0, ref activityId, ref relatedActivityId, EventActivityOptions.Recursive);
+ }
+
+ /// <summary>
+ /// Called by the runtime to stop an assembly load activity for tracing
+ /// </summary>
+ private static void StopAssemblyLoad(ref Guid activityId)
+ {
+ ActivityTracker.Instance.OnStop(NativeRuntimeEventSource.Log.Name, AssemblyLoadName, 0, ref activityId);
+ }
}
}
{
GCX_COOP();
- PREPARE_NONVIRTUAL_CALLSITE(METHOD__ACTIVITY_TRACKER__START_ASSEMBLY_LOAD);
+ PREPARE_NONVIRTUAL_CALLSITE(METHOD__ASSEMBLYLOADCONTEXT__START_ASSEMBLY_LOAD);
DECLARE_ARGHOLDER_ARRAY(args, 2);
args[ARGNUM_0] = PTR_TO_ARGHOLDER(activityId);
args[ARGNUM_1] = PTR_TO_ARGHOLDER(relatedActivityId);
{
GCX_COOP();
- PREPARE_NONVIRTUAL_CALLSITE(METHOD__ACTIVITY_TRACKER__STOP_ASSEMBLY_LOAD);
+ PREPARE_NONVIRTUAL_CALLSITE(METHOD__ASSEMBLYLOADCONTEXT__STOP_ASSEMBLY_LOAD);
DECLARE_ARGHOLDER_ARRAY(args, 1);
args[ARGNUM_0] = PTR_TO_ARGHOLDER(activityId);
DEFINE_METASIG_T(IM(RefGuid_OutIntPtr_RetCustomQueryInterfaceResult, r(g(GUID)) r(I), g(CUSTOMQUERYINTERFACERESULT)))
#endif //FEATURE_COMINTEROP
-// Activity Tracker
+// Assembly Load Context
DEFINE_METASIG_T(SM(RefGuid_RefGuid_RetVoid, r(g(GUID)) r(g(GUID)) , v))
DEFINE_METASIG_T(SM(RefGuid_RetVoid, r(g(GUID)), v))
DEFINE_METHOD(ASSEMBLYLOADCONTEXT, ON_RESOURCE_RESOLVE, OnResourceResolve, SM_Assembly_Str_RetAssembly)
DEFINE_METHOD(ASSEMBLYLOADCONTEXT, ON_TYPE_RESOLVE, OnTypeResolve, SM_Assembly_Str_RetAssembly)
DEFINE_METHOD(ASSEMBLYLOADCONTEXT, ON_ASSEMBLY_RESOLVE, OnAssemblyResolve, SM_Assembly_Str_RetAssembly)
+DEFINE_METHOD(ASSEMBLYLOADCONTEXT, START_ASSEMBLY_LOAD, StartAssemblyLoad, SM_RefGuid_RefGuid_RetVoid)
+DEFINE_METHOD(ASSEMBLYLOADCONTEXT, STOP_ASSEMBLY_LOAD, StopAssemblyLoad, SM_RefGuid_RetVoid)
#ifdef FEATURE_COMINTEROP
DEFINE_CLASS(WINDOWSRUNTIMEMETATADA, WinRT, WindowsRuntimeMetadata)
DEFINE_FIELD_U(_userMessage, ContractExceptionObject, _UserMessage)
DEFINE_FIELD_U(_condition, ContractExceptionObject, _Condition)
-DEFINE_CLASS(ACTIVITY_TRACKER, Tracing, ActivityTracker)
-DEFINE_METHOD(ACTIVITY_TRACKER, START_ASSEMBLY_LOAD, StartAssemblyLoad, SM_RefGuid_RefGuid_RetVoid)
-DEFINE_METHOD(ACTIVITY_TRACKER, STOP_ASSEMBLY_LOAD, StopAssemblyLoad, SM_RefGuid_RetVoid)
-
#ifdef FEATURE_COMINTEROP
DEFINE_CLASS(CAUSALITY_TRACE_LEVEL, WindowsFoundationDiag, CausalityTraceLevel)
DEFINE_CLASS(ASYNC_TRACING_EVENT_ARGS, WindowsFoundationDiag, TracingStatusChangedEventArgs)
#define g_ResourcesNS g_SystemNS ".Resources"
#define g_DiagnosticsNS g_SystemNS ".Diagnostics"
#define g_CodeContractsNS g_DiagnosticsNS ".Contracts"
-#define g_TracingNS g_DiagnosticsNS ".Tracing"
#define g_AssembliesNS g_SystemNS ".Configuration.Assemblies"
#define g_GlobalizationNS g_SystemNS ".Globalization"
#define g_IsolatedStorageNS g_SystemNS ".IO.IsolatedStorage"