@@ -460,7 +460,7 @@ HRESULT STDMETHODCALLTYPE CorProfiler::AssemblyLoadFinished(AssemblyID assembly_
460
460
{
461
461
Logger::Info (" AssemblyLoadFinished: Datadog.Trace.dll v" , assembly_version, " matched profiler version v" ,
462
462
expected_version);
463
- managed_profiler_loaded_app_domains.insert ({assembly_info.app_domain_id , assembly_metadata. version });
463
+ managed_profiler_loaded_app_domains.insert ({assembly_info.app_domain_id , assembly_info. manifest_module_id });
464
464
465
465
// Load defaults values if the version are the same as expected
466
466
if (assembly_metadata.version == expected_assembly_reference.version )
@@ -481,7 +481,7 @@ HRESULT STDMETHODCALLTYPE CorProfiler::AssemblyLoadFinished(AssemblyID assembly_
481
481
if (assembly_info.app_domain_id == corlib_app_domain_id)
482
482
{
483
483
Logger::Info (" AssemblyLoadFinished: Datadog.Trace.dll was loaded domain-neutral" );
484
- managed_profiler_loaded_domain_neutral = true ;
484
+ managed_profiler_domain_neutral_module_id = assembly_info. manifest_module_id ;
485
485
}
486
486
else
487
487
{
@@ -2503,10 +2503,27 @@ bool CorProfiler::GetIntegrationTypeRef(ModuleMetadata& module_metadata, ModuleI
2503
2503
2504
2504
bool CorProfiler::ProfilerAssemblyIsLoadedIntoAppDomain (AppDomainID app_domain_id)
2505
2505
{
2506
- return managed_profiler_loaded_domain_neutral ||
2506
+ return managed_profiler_domain_neutral_module_id > 0 ||
2507
2507
managed_profiler_loaded_app_domains.find (app_domain_id) != managed_profiler_loaded_app_domains.end ();
2508
2508
}
2509
2509
2510
+ ModuleID CorProfiler::GetProfilerAssemblyModuleId (AppDomainID appDomainId)
2511
+ {
2512
+ if (managed_profiler_domain_neutral_module_id > 0 )
2513
+ {
2514
+ return managed_profiler_domain_neutral_module_id;
2515
+ }
2516
+
2517
+ auto it = managed_profiler_loaded_app_domains.find (appDomainId);
2518
+ if (it != managed_profiler_loaded_app_domains.end ())
2519
+ {
2520
+ return it->second ;
2521
+ }
2522
+
2523
+ return 0 ;
2524
+ }
2525
+
2526
+
2510
2527
HRESULT CorProfiler::EmitDistributedTracerTargetMethod (const ModuleMetadata& module_metadata, ModuleID module_id)
2511
2528
{
2512
2529
// Emit a public DistributedTracer.__GetInstanceForProfiler__() method, that will be used by RewriteForDistributedTracing
0 commit comments