DataDog / dd-trace-dotnet

.NET Client Library for Datadog APM
https://docs.datadoghq.com/tracing/
Apache License 2.0
449 stars 141 forks source link

Profiler uses environment variables instead of current module for pinvoke generation #2042

Closed wiktork closed 2 years ago

wiktork commented 2 years ago

When emitting pinvokes, GetCLRProfilerPath uses CORECLR_PROFILER_PATH to figure out the location of the native profiler module. While this works in most cases, it can cause issues in some scenarios:

On Windows this could be done using GetModuleHandleEx/GetModuleFileName. On Linux this could be done using dladdr.

tonyredondo commented 2 years ago

PR with the fix has been merged and it's expected to be out as part of the 2.0 release. Closing this issue.