diff --git a/CHANGELOG.md b/CHANGELOG.md index 254a77bee..b4112595f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ - `SetBeforeCaptureViewHierarchy` signature changed from `Func` to `Func`, now receiving the event that triggered the view hierarchy capture. This allows context-aware decisions before capture begins. ([#2429](https://github.com/getsentry/sentry-unity/pull/2429)) +### Fixes + +- When targeting Windows or Linux with Mono as the scripting backend, to prevent crashes, the native SDK's debug logger integration is disabled. ([#2445](https://github.com/getsentry/sentry-unity/pull/2445)) + ### Features - Added PlayStation Native Support. The SDK now automatically syncs the scope - tags, breadcrumbs, context - to the native layer, so native crashes have the same rich context as managed events. ([#2433](https://github.com/getsentry/sentry-unity/pull/2433)) diff --git a/Directory.Build.targets b/Directory.Build.targets index 125ade4ac..5e471defd 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -605,4 +605,4 @@ void PrintFailedTests(XElement element) - \ No newline at end of file + diff --git a/src/Sentry.Unity.Native/Sentry.Unity.Native.csproj b/src/Sentry.Unity.Native/Sentry.Unity.Native.csproj index bff0c10bc..569b9cee4 100644 --- a/src/Sentry.Unity.Native/Sentry.Unity.Native.csproj +++ b/src/Sentry.Unity.Native/Sentry.Unity.Native.csproj @@ -8,8 +8,10 @@ - - + + + + diff --git a/src/Sentry.Unity.Native/SentryNativeBridge.cs b/src/Sentry.Unity.Native/SentryNativeBridge.cs index 3d056141e..b73ec7203 100644 --- a/src/Sentry.Unity.Native/SentryNativeBridge.cs +++ b/src/Sentry.Unity.Native/SentryNativeBridge.cs @@ -77,9 +77,16 @@ is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer } else { - options.DiagnosticLogger.LogDebug($"{(_logger is null ? "Setting a" : "Replacing the")} native logger"); - _logger = options.DiagnosticLogger; - sentry_options_set_logger(cOptions, new sentry_logger_function_t(nativeLog), IntPtr.Zero); + if (options.UnityInfo.IL2CPP) + { + options.DiagnosticLogger.LogDebug($"{(_logger is null ? "Setting a" : "Replacing the")} native logger"); + _logger = options.DiagnosticLogger; + sentry_options_set_logger(cOptions, new sentry_logger_function_t(nativeLog), IntPtr.Zero); + } + else + { + options.DiagnosticLogger.LogInfo("Passing the native logs back to the C# layer is not supported on Mono - skipping native logger."); + } } options.DiagnosticLogger?.LogDebug("Initializing sentry native");