DataDog / dd-trace-dotnet

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

The process was terminated due to an internal error in the .NET Runtime #6135

Closed Omzig closed 1 month ago

Omzig commented 1 month ago

Describe the bug Running a .net core hosting bundle app in iis results in massive app crashes.

To Reproduce Steps to reproduce the behavior:

  1. install datadog agent
  2. install datadog trace
  3. install .net core 8 app in iis
  4. See error

CoreCLR Version: 8.0.824.36612 .NET Version: 8.0.8 Description: The process was terminated due to an internal error in the .NET Runtime at IP 0x00007FFCFCA63104 (0x00007FFCFCA30000) with exit code 0x80131506.

Could not load type 'Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.AuthenticationHttpContextExtensionsIntegration' from assembly 'Datadog.Trace, Version=3.3.1.0, Culture=neutral, PublicKeyToken=def86d061d0d2eeb'.

Expected behavior Does not crash my app.

Runtime environment (please complete the following information):

Additional context We tried to exclude the app pool in the iis checks, that does not help. dd doc: https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/dotnet-framework/?tab=windows

kevingosse commented 1 month ago

Thanks for the report. We're actively looking into it but this is a complex issue. Ultimately, Universal.Server.exe somehow ends up loading the .NET Framework version of Datadog.Trace.dll (stored in the GAC when installing the tracer) despite being a .NET Core process. I have yet to understand how it happens. For now, the only mitigation I can suggest is disabling auto-instrumentation for Universal.Server.exe (for instance, by setting DD_PROFILER_EXCLUDE_PROCESSES=Universal.Server.exe).

andrewlock commented 3 weeks ago

Hi @Omzig this should be fixed in v3.4.0. Thanks!