Skip to content

Commit fe0e5de

Browse files
authored
fix: Reinstall native backend (#1603)
1 parent a09d431 commit fe0e5de

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixes
66

7+
- The SDK no longer fails to capture native crashes on Windows. It now properly reinstalls the capturing backend during the initialization ([#1603](https://github.com/getsentry/sentry-unity/pull/1603))
78
- When building for iOS, the SDK no longer adds its dependencies multiple times (#1558) ([#1595](https://github.com/getsentry/sentry-unity/pull/1595))
89

910
### Dependencies

Diff for: src/Sentry.Unity.Native/SentryNative.cs

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ public static void Configure(SentryUnityOptions options, ISentryUnityInfo sentry
6969
}
7070
}
7171
options.CrashedLastRun = () => crashedLastRun;
72+
73+
// At this point Unity has taken the signal handler and will not invoke our handler. So we register our
74+
// backend once more to make sure user-defined data is available in the crash report and the SDK is able
75+
// to capture the crash.
76+
SentryNativeBridge.ReinstallBackend();
7277
}
7378
}
7479
}

Diff for: src/Sentry.Unity.Native/SentryNativeBridge.cs

+5
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ internal static string GetCacheDirectory(SentryUnityOptions options)
104104
}
105105
}
106106

107+
internal static void ReinstallBackend() => sentry_reinstall_backend();
108+
107109
// libsentry.so
108110
[DllImport("sentry")]
109111
private static extern IntPtr sentry_options_new();
@@ -276,5 +278,8 @@ private static void WithMarshalledStruct<T>(T structure, Action<IntPtr> action)
276278

277279
[DllImport("sentry")]
278280
private static extern int sentry_clear_crashed_last_run();
281+
282+
[DllImport("sentry")]
283+
private static extern void sentry_reinstall_backend();
279284
}
280285
}

0 commit comments

Comments
 (0)