Skip to content

Conversation

@bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Nov 24, 2025

Resolves #2050

#skip-changelog

@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against be9b692

@bitsandfoxes bitsandfoxes marked this pull request as ready for review November 26, 2025 14:50
Comment on lines +244 to +245
[DllImport("__Internal")]
private static extern int vsnprintf_sentry(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: [DllImport("__Internal")] in SentryNativeBridge causes EntryPointNotFoundException on Windows/Linux Mono players.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

On Windows and Linux standalone players using the Mono runtime, the SentryNativeBridge.vsnprintf_sentry method will cause a runtime EntryPointNotFoundException. This occurs because [DllImport("__Internal")] is an IL2CPP-specific mechanism, but these platforms use Mono, which cannot resolve __Internal symbols. The crash will happen when nativeLogImpl attempts to format a message using vsnprintf_sentry.

💡 Suggested Fix

Revert [DllImport("__Internal")] for vsnprintf_sentry to platform-specific system libraries (msvcrt for Windows, libc for Linux) or implement platform-specific conditional compilation.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/Sentry.Unity.Native/SentryNativeBridge.cs#L244-L245

Potential issue: On Windows and Linux standalone players using the Mono runtime, the
`SentryNativeBridge.vsnprintf_sentry` method will cause a runtime
`EntryPointNotFoundException`. This occurs because `[DllImport("__Internal")]` is an
IL2CPP-specific mechanism, but these platforms use Mono, which cannot resolve
`__Internal` symbols. The crash will happen when `nativeLogImpl` attempts to format a
message using `vsnprintf_sentry`.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 4258752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for PlayStation

3 participants