opentelemetry-dotnet-instrumentation
opentelemetry-dotnet-instrumentation copied to clipboard
Hardcoded name of the output file in the code
Describe the bug There is a hardcoded output file name here. It was confirmed that it causes client applications with profiler attached to crash when the .dylib file's name is changed after compilation - see this comment for reference.
To Reproduce Steps to reproduce the behavior:
- Install profiler on macOS
- Rename .dylib file
- Set new name in CORECLR_PROFILER_PATH
- Run application
- Application crashes
Expected behavior I assume name of the profiler file should not affect how it works, and definitely shouldn't crash client apps.
Screenshots If applicable, add screenshots to help explain your problem.
Runtime environment (please complete the following information):
- Instrumentation mode: Used files compiled on my machine
- OS: macOS Catalina Version 10.15.7 (19H524)
- .NET version: .NET 5
Actual behaviour The application crashed with
Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow.
at DDVoidMethodType.DDVoidMethodCall()
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Mac OS related. @tonyredondo should we tweak this. Can you please advise? :)
Assigning the tracking item to myself to keep current.
I am facing the same issue with 3.1 runtime.
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Runtime.InteropServices.Marshal.CopyToManaged[T](IntPtr source, T[] destination, Int32 startIndex, Int32 length) at System.Runtime.InteropServices.Marshal.Copy(IntPtr source, Byte[] destination, Int32 startIndex, Int32 length) at DDVoidMethodType.DDVoidMethodCall() at hellowold.Program.<Main>(String[] args)
@piyushbicycle fyi we just switched the main branch on the repo so now we are using the previously named poc-otel-sdk, so a lot of changes.
Anyway, this error happens when the build doesn't properly add the Loader assembly as a resource of the native dll. We had fixed by @RassK by downgrading CMake (the version that we were using didn't add the resource correctly).
@pjanotti
The bug is still there: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/1cb8c5ededad090c78df93dea3980b8626387eb5/src/OpenTelemetry.ClrProfiler.Native/cor_profiler.cpp#L2960
As far as I understand the code the loader assembly is not properly read because OpenTelemetry.ClrProfiler.Native.dylib is hardcoded. It results in assemblySize, pAssemblyArray, symbolsSize, pSymbolsArray not being properly assigned.
@pellared How can I make this work on my mac?
Reference removed in scope of #2216