From a497c3958479c21ff262567d7916b181431109c2 Mon Sep 17 00:00:00 2001 From: Kevin Gosse Date: Mon, 6 Jan 2025 15:01:58 +0100 Subject: [PATCH] Log an error message when the profiler is loaded multiple times --- tracer/src/Datadog.Tracer.Native/cor_profiler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp b/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp index d9c69641405a..1ec8d07a80d8 100644 --- a/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp +++ b/tracer/src/Datadog.Tracer.Native/cor_profiler.cpp @@ -51,6 +51,13 @@ HRESULT STDMETHODCALLTYPE CorProfiler::Initialize(IUnknown* cor_profiler_info_un Logger::EnableDebug(true); } + if (profiler != nullptr) + { + Logger::Error("The Tracer Profiler is initialized multiple times. This may cause unpredictable failures.", + " When running aspnetcore in IIS, make sure to disable managed code in the application pool settings.", + " https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/advanced?view=aspnetcore-9.0#create-the-iis-site"); + } + CorProfilerBase::Initialize(cor_profiler_info_unknown); // we used to bail-out if tracing was disabled, but we now allow the tracer to be loaded