Skip to content

Windows mono native dll clash - #2819

Open
lgarczyn wants to merge 3 commits into
getsentry:mainfrom
lgarczyn:windows-mono-native-dll-clash
Open

Windows mono native dll clash#2819
lgarczyn wants to merge 3 commits into
getsentry:mainfrom
lgarczyn:windows-mono-native-dll-clash

Conversation

@lgarczyn

Copy link
Copy Markdown

Fixed native crash capture on Windows with the Mono scripting backend. The native library is now copied into the player as sentry-native, so DllImport can no longer resolve to the managed Sentry.dll sitting beside it in Managed/ #2818

Built with fable, if you have a better idea of how to fix this, I would not complain

lgarczyn and others added 3 commits August 24, 2026 02:22
On Windows with Mono, DllImport("sentry") from Sentry.Unity.Native.dll resolved to the
managed Sentry.dll next to it in Managed/, because Mono probes the calling assembly's own
directory first and Windows filenames are case-insensitive. Native init then failed with
EntryPointNotFoundException and no crashes were ever captured.

CleanupStaleMacOSArtifacts already works around the same shape of clash on case-insensitive
APFS. On Windows the collider is the SDK's own managed assembly and cannot be deleted, so the
native library gets a name of its own instead.

SentryLib is a single const in a single precompiled assembly, so Linux and the macOS
sentry-native backend are renamed to match. The Cocoa Sentry.dylib is dlopened by name and
keeps it, as do PlayStation, Xbox and Switch.
Android's libsentry.so ships from the sentry-android-ndk AAR, so the rename does
not apply there and the previous commit would have broken it. Build a fourth
variant the same way the consoles do, and swap the base assembly out of the
Android player for it.
…ents

The Linux branch renamed every .so it found to sentry-native, where Windows and
macOS match the exact filename. Make Linux symmetric.
@lgarczyn
lgarczyn requested a review from bitsandfoxes as a code owner August 24, 2026 03:00
@bitsandfoxes

Copy link
Copy Markdown
Contributor

Hey @lgarczyn, thanks for the contribution. I'll need to figure out a way to make sure this also works with our console support but other than that it mostly looks good to me.

@lgarczyn

Copy link
Copy Markdown
Author

Hey @lgarczyn, thanks for the contribution. I'll need to figure out a way to make sure this also works with our console support but other than that it mostly looks good to me.

No worries! We are using our fork for now, hasn't reoccured yet

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.

2 participants