From 4ae8894f13ee5ae62b4f7976ca55d0ab2bb2ba05 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Fri, 19 Sep 2025 09:18:28 +0200 Subject: [PATCH] [nativeaot] Log location of the actual p/invoke stub called Context: 869b0e03937e0c17a4cf3fbc85f50d80350b2576 The `pinvoke_unreachable` function, when invoked, would log its own source location instead of that of the call site. That's a bit useless in diagnosing issues, so let's improve it by logging the call site location... :) --- src/native/nativeaot/host/internal-pinvoke-stubs.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/native/nativeaot/host/internal-pinvoke-stubs.cc b/src/native/nativeaot/host/internal-pinvoke-stubs.cc index 8cea50867b2..877ba869020 100644 --- a/src/native/nativeaot/host/internal-pinvoke-stubs.cc +++ b/src/native/nativeaot/host/internal-pinvoke-stubs.cc @@ -5,9 +5,14 @@ using namespace xamarin::android; namespace { [[gnu::noreturn]] - void pinvoke_unreachable () + void pinvoke_unreachable (std::source_location sloc = std::source_location::current ()) { - Helpers::abort_application (LOG_DEFAULT, "The method is not implemented. This is a stub and should not be called."sv); + Helpers::abort_application ( + LOG_DEFAULT, + "The p/invoke is not implemented. This is a stub and should not be called."sv, + true, // log_location + sloc + ); } }