dd-trace-dotnet icon indicating copy to clipboard operation
dd-trace-dotnet copied to clipboard

Exception "The profiler is not connected or is not compiled as DEBUG ..." when run CallTargetNativeTest project on .NET6.0

Open InCerryGit opened this issue 2 years ago • 0 comments

Describe the bug

I tried to build dd-trace locally and the build went well, but the test project had problems. When I run the CallTragetNativeTest project in. NET 6.0, an exception is thrown: Unhandled exception. System.Exception: The profiler is not connected or is not compiled as DEBUG with the DD_CTARGET_TESTMODE=True environment variable.

To Reproduce

  1. I ran the build.ps1 file, located in the tracer directory, and built the following files. image

  2. Then I ran the CallTargetNativeTest test project. It worked normally in. NET461, but it threw an exception in. NET6.0. image

Expected behavior It should be able to run the test normally

Runtime environment (please complete the following information):

  • Tracer version: I use the https://github.com/DataDog/dd-trace-dotnet/releases/tag/v2.14.0
  • OS: Windows11 22H2
  • CLR: .NET 6.0
  • Environment variables:
{
  "profiles": {
    "CallTargetNativeTest": {
      "commandName": "Project",
      "commandLineArgs": "0",
      "environmentVariables": {
        "DD_CTARGET_TESTMODE": "True",
        "DD_DOTNET_TRACER_HOME": "$(SolutionDir)shared\\bin\\monitoring-home",
        "COR_ENABLE_PROFILING": "1",
        "CORECLR_ENABLE_PROFILING": "1",
        "COR_PROFILER_PATH": "$(SolutionDir)shared\\bin\\monitoring-home\\win-$(Platform)\\Datadog.Trace.ClrProfiler.Native.dll",
        "DD_DUMP_ILREWRITE_ENABLED": "1",
        "CORECLR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}",
        "CORECLR_PROFILER_PATH": "$(SolutionDir)shared\\bin\\monitoring-home\\win-$(Platform)\\Datadog.Trace.ClrProfiler.Native.dll",
        "DD_VERSION": "1.0.0",
        "DD_CLR_ENABLE_INLINING": "1",
        "COR_PROFILER": "{846F5F1C-F9AE-4B07-969E-05C26BC060D8}",
        "DD_TRACE_LOG_DIRECTORY": "E:\\DDLogs\\Source",
        "DD_TRACE_DEBUG": "1"
      },
      "nativeDebugging": true
    }
  }
}

Logs

dotnet-tracer-loader-CallTargetNativeTest-23824.log dotnet-native-loader-CallTargetNativeTest-23824.log dotnet-tracer-managed-CallTargetNativeTest-20220914.log dotnet-tracer-native-CallTargetNativeTest-23824.log

InCerryGit avatar Sep 14 '22 02:09 InCerryGit