Skip to content

fix: native support when using Mono on Windows - #2842

Open
bitsandfoxes wants to merge 1 commit into
mainfrom
fix/native-library-name-clash
Open

fix: native support when using Mono on Windows#2842
bitsandfoxes wants to merge 1 commit into
mainfrom
fix/native-library-name-clash

Conversation

@bitsandfoxes

Copy link
Copy Markdown
Contributor

Closes #2818, continues #2819

Native crash capture never worked on Windows with the Mono scripting backend. Mono probes the calling assembly's own folder first, so DllImport("sentry") from Sentry.Unity.Native.dll resolved to the managed Sentry.dll sitting beside it in Managed/ on a case-insensitive file system. That load succeeds, the C entry point is missing, and native support dies with an EntryPointNotFoundException that only surfaces when the diagnostic logger is enabled.

The desktop library now ships renamed. native-sdks.targets writes it out as sentry-native.dll, libsentry-native.so and libsentry-native.dylib while the SDK is built, so the package already carries the new names and the post-build step stays a plain copy. Debug sidecars keep the names their binaries record.

Android cannot follow. Its libsentry.so comes from the sentry-android-ndk AAR and sentry-java loads it by name from Java, so it gets its own Sentry.Unity.Native.Android.dll, built from the same sources with a define the way the console variants already are.

Native crash capture never worked on Windows with the Mono scripting
backend. Mono probes the calling assembly's own folder first, so
`DllImport("sentry")` from `Sentry.Unity.Native.dll` resolved to the
managed `Sentry.dll` sitting beside it in `Managed/` on a
case-insensitive file system. That load succeeds, the C entry point is
missing, and native support dies with an `EntryPointNotFoundException`
that only surfaces when the diagnostic logger is enabled.

The desktop library now ships renamed. `native-sdks.targets` writes it
out as `sentry-native.dll`, `libsentry-native.so` and
`libsentry-native.dylib` while the SDK is built, so the package already
carries the new names and the post-build step stays a plain copy. Debug
sidecars keep the names their binaries record.

Android cannot follow. Its `libsentry.so` comes from the
sentry-android-ndk AAR and sentry-java loads it by name from Java, so it
gets its own `Sentry.Unity.Native.Android.dll`, built from the same
sources with a define the way the console variants already are.

Closes #2818

Co-authored-by: Lou Garczynski <louis.roc@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A1tV2g8KkFQGYdCGLWSay6
@github-actions

Copy link
Copy Markdown
Contributor
Fails
🚫

CHANGELOG.md#L1081 - The changelog entry seems to be part of an already released section ## 4.9.0.
Consider moving the entry to the ## Unreleased section, please.

Generated by 🚫 dangerJS against 108677e

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.

crash report don't work on windows due to dll name conflict

1 participant