-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat: PlayStation native support #2433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
| [DllImport("__Internal")] | ||
| private static extern int vsnprintf_il2cpp(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: DllImport for vsnprintf_il2cpp lacks EntryPoint attribute, causing EntryPointNotFoundException and silent failure of native log forwarding on IL2CPP.
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The DllImport for vsnprintf_il2cpp at src/Sentry.Unity.Native/SentryNativeBridge.cs lines 254-255 is missing the EntryPoint attribute. The C# method vsnprintf_il2cpp does not match the native C function vsnprintf_sentry. Without EntryPoint, the P/Invoke runtime will fail to find the correct native symbol, leading to an EntryPointNotFoundException on IL2CPP platforms (e.g., PlayStation). Although caught, this exception causes native log forwarding to silently fail, resulting in a loss of critical diagnostic information.
💡 Suggested Fix
Add EntryPoint = "vsnprintf_sentry" to the DllImport attribute for vsnprintf_il2cpp to correctly map the C# method to the native C function.
🤖 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#L254-L255
Potential issue: The `DllImport` for `vsnprintf_il2cpp` at
`src/Sentry.Unity.Native/SentryNativeBridge.cs` lines 254-255 is missing the
`EntryPoint` attribute. The C# method `vsnprintf_il2cpp` does not match the native C
function `vsnprintf_sentry`. Without `EntryPoint`, the P/Invoke runtime will fail to
find the correct native symbol, leading to an `EntryPointNotFoundException` on IL2CPP
platforms (e.g., PlayStation). Although caught, this exception causes native log
forwarding to silently fail, resulting in a loss of critical diagnostic information.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 4635821
|
|
||
| // For IL2CPP: use __Internal which links to the compiled sentry_utils.c | ||
| [DllImport("__Internal")] | ||
| private static extern int vsnprintf_il2cpp(IntPtr buffer, UIntPtr bufferSize, IntPtr format, IntPtr args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: P/Invoke function name mismatch with native C function
The [DllImport("__Internal")] declaration for vsnprintf_il2cpp expects a native function with that exact name, but sentry_utils.c exports the function as vsnprintf_sentry. When using __Internal without an EntryPoint attribute, IL2CPP looks for a function matching the C# method name exactly. This mismatch will cause a linker error when building for IL2CPP platforms. The declaration needs EntryPoint = "vsnprintf_sentry" or the C function needs to be renamed to vsnprintf_il2cpp.
Resolves #2050
#skip-changelog