diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 78310a520..0669c7f46 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -2,7 +2,7 @@ aliases: - &2020 "2020.3.48f1" - &2021 "2021.3.36f1" - &2022 "2022.3.22f1" - - &2023 "2023.2.17f1" + - &2023 "2023.2.19f1" agents: @@ -186,8 +186,6 @@ steps: - label: Run WebGL e2e tests for Unity 2020 timeout_in_minutes: 30 depends_on: "cocoa-webgl-2020-fixtures" - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2020 plugins: @@ -221,8 +219,6 @@ steps: - label: Run WebGL e2e tests for Unity 2022 timeout_in_minutes: 30 depends_on: 'cocoa-webgl-2022-fixtures' - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2022 plugins: @@ -238,8 +234,6 @@ steps: - label: Run WebGL e2e tests for Unity 2023 timeout_in_minutes: 30 depends_on: 'cocoa-webgl-2023-fixtures' - agents: - queue: opensource-mac-cocoa-11 env: UNITY_VERSION: *2023 plugins: diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index d01d7c487..553ee3ba3 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -128,7 +128,6 @@ steps: - "--device=ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13" - "--no-tunnel" - "--aws-public-ip" - - "--fail-fast" concurrency: 25 concurrency_group: "bitbar" concurrency_method: eager diff --git a/CHANGELOG.md b/CHANGELOG.md index 265c1da97..81a4db57b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,39 @@ # Changelog +## 8.0.0 (2024-06-12) + +### Enhancements + +- Added the `Bugsnag-Integrity` header to outgoing Bugsnag requests to avoid extraneous releases being generated if payloads are altered. [#797](https://github.com/bugsnag/bugsnag-unity/pull/797) + +- Changed `Configuration.DiscardClasses` and `Configuration.RedactedKeys` to Regex types. [#807](https://github.com/bugsnag/bugsnag-unity/pull/807) + +- `Event.Unhandled` is (accessed via OnError and OnSend callbacks) is now non-nullable. [#813](https://github.com/bugsnag/bugsnag-unity/pull/813) + +### Bug Fixes + +- Added a null check to the Bugsnag client to prevent crashes when accessing the client before it has been initialised [#788](https://github.com/bugsnag/bugsnag-unity/pull/788) + +- Made all callback collections within the Configuration class thread safe. [#810](https://github.com/bugsnag/bugsnag-unity/pull/810) + +- Added GenerateAnonymousId to the BugsnagSettingsObject. This fixes a null object reference error on GenerateAnonymousId when using both the performance SDK and Error monitoring SDK, where the error monitoring SDK shares the confirguration with the performance monitoring SDK. [#812](https://github.com/bugsnag/bugsnag-unity/pull/812) + +### Dependencies + +- Update bugsnag-cocoa to [v6.28.1](https://github.com/bugsnag/bugsnag-cocoa/releases/tag/v6.28.1) [#774](https://github.com/bugsnag/bugsnag-unity/pull/774) + +- Update bugsnag-android from [v5.30.0](https://github.com/bugsnag/bugsnag-android/releases/tag/v5.30.0) to [v6.5.0](https://github.com/bugsnag/bugsnag-android/releases/tag/v6.5.0) + +### Deprecations + +- Bugsnag Unity will no longer officially support Unity versions below Unity 2020. Older versions may work, but we will not test against them during development. + + ## 7.7.6 (2024-05-17) -- Fixed issue where meta files for the MacOS bundle were not generated. [#802](https://github.com/bugsnag/bugsnag-unity/pull/802) +### Bug Fixes +- Fixed issue where meta files for the MacOS bundle were not generated. [#802](https://github.com/bugsnag/bugsnag-unity/pull/802) ## 7.7.5 (2024-05-02) @@ -41,7 +71,6 @@ ### Enhancements - Added `IsStarted` check method that returns false if start has not been called on the BugSnag client. - - Update bugsnag-cocoa from v6.27.2 to [v6.28.0](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6280-2023-12-13) ## 7.6.5 (2023-08-17) @@ -56,11 +85,9 @@ - Add null guard in the Bugsnag exception handler. [#734](https://github.com/bugsnag/bugsnag-unity/pull/734) - ## 7.6.3 (2023-08-03) - Update bugsnag-cocoa from v6.26.2 to [v6.27.2](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6272-2023-07-24) - ### Bug Fixes - Handle exceptions thrown during deserialisation of a cached events and sessions and log the problematic json. [#731](https://github.com/bugsnag/bugsnag-unity/pull/731) @@ -71,7 +98,6 @@ - Remove unnecessary usages of DateTimeOffset.Now to prevent iOS app hangs resulting from Unity native code accessing non-thread safe methods. [#725](https://github.com/bugsnag/bugsnag-unity/pull/725) - ## 7.6.1 (2023-06-13) ### Bug Fixes @@ -82,11 +108,9 @@ - Update bugsnag-cocoa from v6.25.2 to [v6.26.2](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6262-2023-04-20) - Update bugsnag-android from v5.28.4 to [v5.30.0](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5300-2023-05-11) - ### Bug fixes * Fix an issue where stack frames containing (wrapper some/wrapper) entries were incorrectly formatted. [#713](https://github.com/bugsnag/bugsnag-unity/pull/713) - * Fix an issue where Config.GenerateAnonymousId was not respected. [#704](https://github.com/bugsnag/bugsnag-unity/pull/704) ## 7.5.2 (2023-03-08) @@ -94,7 +118,6 @@ ### Bug fixes * Fix a race condition in Bugsnag.Start involving creation of gameobjects outside of the main Unity thread. [#699](https://github.com/bugsnag/bugsnag-unity/pull/699) - * Fix an issue causing empty stacktraces in some Android events. [#700](https://github.com/bugsnag/bugsnag-unity/pull/700) ### Dependency updates @@ -110,9 +133,7 @@ ### Bug fixes * Fix an issue where collections in metadata were not present in native Android crashes. [#685](https://github.com/bugsnag/bugsnag-unity/pull/685) - * Fix an issue where errors in serialisation threw exceptions. [#693](https://github.com/bugsnag/bugsnag-unity/pull/693) - * Fix an issue where persisted events had 'unhandled' set to null [#695](https://github.com/bugsnag/bugsnag-unity/pull/695) ## 7.5.0 (2023-01-04) @@ -120,11 +141,8 @@ ### Enhancements * Added checks in delivery to ensure payloads can't get stuck in a retry loop. [#683](https://github.com/bugsnag/bugsnag-unity/pull/683) - * Raised `Configuration.MaxBreadcrumbs` default from 50 to 100, raised the limit from 100 to 500 and added a check to truncate breadcrumbs from oversized payloads. [#671](https://github.com/bugsnag/bugsnag-unity/pull/671) - * Add `Configuration.MaxStringValueLength` config option. [#668](https://github.com/bugsnag/bugsnag-unity/pull/668) - * Added `Telemetry.Usage` configuration option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#telemetry) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#telemetry) [#666](https://github.com/bugsnag/bugsnag-unity/pull/666) ### Dependency updates @@ -135,15 +153,10 @@ ### Bug fixes * Fix an issue where bundle version was not reported correctly on iOS and MacOS. [#672](https://github.com/bugsnag/bugsnag-unity/pull/672) - * Fix an issue where a null value in metadata could cause an exception. [#652](https://github.com/bugsnag/bugsnag-unity/pull/652) - * Fix an issue where android metadata was not deserialised as the correct type, which could cause exceptions when processing metadata. [#652](https://github.com/bugsnag/bugsnag-unity/pull/652) - * Fix an issue where android sessions had inaccurate Session.Handled and Unhandled counts. [#684](https://github.com/bugsnag/bugsnag-unity/pull/684) - * Fix an issue where Cocoa Device and App data was serialized incorrectly causing invalid cast exceptions in callbacks [#680](https://github.com/bugsnag/bugsnag-unity/pull/680) - * Fixed an issue where user changes made in OnSession callbacks did not make it to the generated payload [#681](https://github.com/bugsnag/bugsnag-unity/pull/681) ## 7.4.0 (2022-10-26) @@ -188,10 +201,8 @@ * Fixed issue where exceptions thrown in async methods were missing some stack frames [#610](https://github.com/bugsnag/bugsnag-unity/pull/610) - * Added `DontSave` HideFlags to gameObjects created by the Bugsnag SDK to negate the chances of them making scenes dirty in the editor [#604](https://github.com/bugsnag/bugsnag-unity/pull/604) - * Fixed compilation errors when building with IL2CPP for Android after changes to the Unity API `BlockCopy` method caused `ArgumentException` [#605](https://github.com/bugsnag/bugsnag-unity/pull/605) @@ -215,21 +226,16 @@ * Increased thread saftey of the metadata dictionary in Bugsnag.LeaveBreadcrumb [#564](https://github.com/bugsnag/bugsnag-unity/pull/564) - * Fixed an issue where events occuring directly after Bugsnag init had no session information attached. [#571](https://github.com/bugsnag/bugsnag-unity/pull/571) - ## 7.0.0 (2022-05-30) This version contains **breaking** changes: some errors generated by the new version will no longer group in the Bugnsag dashboard with equivalent errors generated by older versions. This is due to the introduction of a new exception interceptor that gets passed the C# exception objects, rather than having to parse the information from Unity logs. - Please see the [upgrade guide](./UPGRADING.md) for details of all the changes and instructions on how to upgrade. - ### Dependency updates * Update bugsnag-android from v5.22.0 to [v5.22.4](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5224-2022-05-24) - * Update bugsnag-cocoa from v6.16.1 to [v6.17.1](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6171-2022-05-18) ## 6.3.2 (2022-05-27) @@ -258,7 +264,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * Fixed an issue where the use of ToUpper caused a crash on devices using the Turkish language [#543](https://github.com/bugsnag/bugsnag-unity/pull/543) - * Fixed an issue where breadcrumbs with null messages caused errors [#545](https://github.com/bugsnag/bugsnag-unity/pull/545) @@ -267,7 +272,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an ### Enhancements * Added Android support for [EDM4U](https://github.com/googlesamples/unity-jar-resolver). For manual installs there see the new menu item at Window/Bugsnag/Enable EDM Support. For UPM installs we have a [dedicated package](https://github.com/bugsnag/bugsnag-unity-upm-edm4u). [#528](https://github.com/bugsnag/bugsnag-unity/pull/528) - * Update bugsnag-android to v5.21.0 * Fix inconsistencies in stack trace quality for C/C++ events. Resolves a few cases where file and line number information was not resolving to the correct @@ -283,9 +287,7 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an ### Enhancements * Added offline persistence of C# events/exceptions (all platforms); and of sessions and device ID (Windows and WebGL) [#512](https://github.com/bugsnag/bugsnag-unity/pull/512) [#509](https://github.com/bugsnag/bugsnag-unity/pull/509) [#514](https://github.com/bugsnag/bugsnag-unity/pull/514) - * Add `Configuration.MaxReportedThreads` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#maxreportedthreads) [523](https://github.com/bugsnag/bugsnag-unity/pull/523) - * Update bugsnag-android to v5.20.0 * The number of threads reported can now be limited using `Configuration.setMaxReportedThreads` (defaulting to 200) [bugsnag-android#1607](https://github.com/bugsnag/bugsnag-android/pull/1607) @@ -300,7 +302,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * New APIs to support forthcoming feature flag and experiment functionality. For more information, please see https://docs.bugsnag.com/product/features-experiments [#504](https://github.com/bugsnag/bugsnag-unity/pull/504) [#501](https://github.com/bugsnag/bugsnag-unity/pull/501) - * Update bugsnag-cocoa to v6.16.1 * New APIs to support forthcoming feature flag and experiment functionality. For more information, please see https://docs.bugsnag.com/product/features-experiments @@ -337,7 +338,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an [bugsnag-cocoa#1214](https://github.com/bugsnag/bugsnag-cocoa/pull/1214) * Fix missing imports when building with `CLANG_ENABLE_MODULES=NO` [bugsnag-cocoa#1284](https://github.com/bugsnag/bugsnag-cocoa/pull/1284) - * Update bugsnag-android to v5.19.2 * New APIs to support forthcoming feature flag and experiment functionality. For more information, please see https://docs.bugsnag.com/product/features-experiments. * Explicitly define Kotlin api/language versions @@ -353,15 +353,11 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * Fix a bug where api keys set in React Native callbacks were ignored [bugsnag-android#1592](https://github.com/bugsnag/bugsnag-android/pull/1592) - ## 6.0.0 (2022-01-20) This version contains **breaking** changes, as bugsnag-unity has been updated to allow for more convenient and performant initialisation and configuration features. - Please see the [upgrade guide](./UPGRADING.md) for details of all the changes and instructions on how to upgrade. - In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag Android Notifier has been updated. See below for details. - * Update bugsnag-android to v5.18.0 * Bump compileSdkVersion to apiLevel 31 [bugsnag-android#1536](https://github.com/bugsnag/bugsnag-android/pull/1536) @@ -396,14 +392,13 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A * Update bugsnag-cocoa to v6.14.2 * Fix missing `configuration.user` and manually resumed `session` info in unhandled errors. [bugsnag-cocoa#1215](https://github.com/bugsnag/bugsnag-cocoa/pull/1215) -* Update bugsnag-android to v5.15.0 +* Update bugsnag-android to v5.15.0 * Avoid reporting false-positive background ANRs with improved foreground detection [bugsnag-android#1429](https://github.com/bugsnag/bugsnag-android/pull/1429) * Prevent events being attached to phantom sessions when they are blocked by an `OnSessionCallback` [bugsnag-android#1434](https://github.com/bugsnag/bugsnag-android/pull/1434) * Plugins will correctly mirror metadata added using `addMetadata(String, Map)` [bugsnag-android#1454](https://github.com/bugsnag/bugsnag-android/pull/1454) - ### Bug fixes * Fixed an issue where breadcrumbs from non fatal apphang errors caused a crash on retrieval @@ -414,12 +409,10 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A ### Enhancements * Removed the limit on the length of a breadcrumbs name [#399](https://github.com/bugsnag/bugsnag-unity/pull/399) - * Update bugsnag-android to v5.14.0 * Capture and report thread state (running, sleeping, etc.) for Android Runtime and Native threads [bugsnag-android#1367](https://github.com/bugsnag/bugsnag-android/pull/1367) [bugsnag-android#1390](https://github.com/bugsnag/bugsnag-android/pull/1390) - * Update bugsnag-cocoa to v6.14.1 * Disable automatic session tracking in app extensions (it was not working as intended.) [bugsnag-cocoa#1211](https://github.com/bugsnag/bugsnag-cocoa/pull/1211) @@ -429,7 +422,7 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A [bugsnag-cocoa#1209](https://github.com/bugsnag/bugsnag-cocoa/pull/1209) * Apply `redactedKeys` to breadcrumb metadata. [bugsnag-cocoa#1204](https://github.com/bugsnag/bugsnag-cocoa/pull/1204) - * Capture and report thread states (running, stopped, waiting, etc.) + * Capture and report thread states (running, stopped, waiting, etc.) [bugsnag-cocoa#1200](https://github.com/bugsnag/bugsnag-cocoa/pull/1200) * Disable app hang detection for app extensions. [bugsnag-cocoa#1198](https://github.com/bugsnag/bugsnag-cocoa/pull/1198) @@ -444,24 +437,18 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A ### Enhancements * Update bugsnag-cocoa to v6.12.2 - * Stop dropping breadcrumbs when provided invalid metadata (that is not JSON convertible.) [bugsnag-cocoa#1187](https://github.com/bugsnag/bugsnag-cocoa/pull/1187) - * Fix Swift fatal error parsing for messages with no filename. [bugsnag-cocoa#1186](https://github.com/bugsnag/bugsnag-cocoa/pull/1186) - * Events now include a `thermalState` property in the `device` tab, and unexpected app terminations that occur when the thermal state is critical will now be reported as a "Thermal Kill" rather than Out Of Memory error. [bugsnag-cocoa#1171](https://github.com/bugsnag/bugsnag-cocoa/pull/1171) - * Fix a regression where the session was not captured at launch if Bugsnag was started before `willFinishLaunchingWithOptions` in iOS apps that do not adopt the UIScene life-cycle. [bugsnag-cocoa#1180](https://github.com/bugsnag/bugsnag-cocoa/pull/1180) - * Fatal app hangs will no longer be reported if the `willTerminateNotification` is received. [bugsnag-cocoa#1176](https://github.com/bugsnag/bugsnag-cocoa/pull/1176) - * Update bugsnag-android to v5.13.0 * The `app.lowMemory` value always report the most recent `onTrimMemory`/`onLowMemory` status [bugsnag-android#1342](https://github.com/bugsnag/bugsnag-android/pull/1342) * Added the `app.memoryTrimLevel` metadata to report a description of the latest `onTrimMemory` status [bugsnag-android#1344](https://github.com/bugsnag/bugsnag-android/pull/1344) @@ -479,18 +466,11 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A [bugsnag-android#1375](https://github.com/bugsnag/bugsnag-android/pull/1375) * Use SystemClock.elapsedRealtime to track `app.durationInForeground` [bugsnag-android#1375](https://github.com/bugsnag/bugsnag-android/pull/1375) - - * Add new automatically collected Device data to Windows, WebGL and Unity Editor events: `batteryLevel, charging, id, model, screenDensity, screenResolution, totalMemory` [#390](https://github.com/bugsnag/bugsnag-unity/pull/390) - * Add new automatically collected App data to Windows, WebGL and Unity Editor events: `duration, id, isLaunching, lowMemory` [#390](https://github.com/bugsnag/bugsnag-unity/pull/390) - * Add new Bugsnag.Notify overloads: `Notify(exception, stacktrace)` `Notify(exception, stacktrace, callback)` `Notify(name, message, stacktrace)` `Notify(name, message, stacktrace, callback)` [#380](https://github.com/bugsnag/bugsnag-unity/pull/380) - * Add `Bugsnag.GetLastRunInfo()` To get relevant crash information regarding the last run of the application [#379](https://github.com/bugsnag/bugsnag-unity/pull/379) - * Add `Configuration.SendLaunchCrashesSynchronously` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#launchdurationmillis) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#launchdurationmillis) [#379](https://github.com/bugsnag/bugsnag-unity/pull/379) - * Add `Configuration.LaunchDurationMillis` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#sendlaunchcrashessynchronously) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#sendlaunchcrashessynchronously) [#379](https://github.com/bugsnag/bugsnag-unity/pull/379) ### Deprecated @@ -502,203 +482,138 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A * Fixed an issue where app.type was not sent in native Cocoa crash reports [#395](https://github.com/bugsnag/bugsnag-unity/pull/395) - ## 5.3.0 (2021-09-01) ### Enhancements * Add `Configuration.VersionCode` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#versioncode) [#373](https://github.com/bugsnag/bugsnag-unity/pull/373) - * Add `Configuration.PersistenceDirectory` to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#persistencedirectory) [#368](https://github.com/bugsnag/bugsnag-unity/pull/368) - * Add `Configuration.SendThreads` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#sendthreads) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#sendthreads) [#375](https://github.com/bugsnag/bugsnag-unity/pull/375) - * Add `Configuration.PersistUser` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#persistuser) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#persistuser) [#372](https://github.com/bugsnag/bugsnag-unity/pull/372) - * Add `Configuration.MaxPersistedEvents` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#maxpersistedevents) and the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#maxpersistedevents) [#371](https://github.com/bugsnag/bugsnag-unity/pull/371) - * Add `Configuration.RedactedKeys` configuration option to enable redacting specific keys in metadata [#367](https://github.com/bugsnag/bugsnag-unity/pull/367) - * Add `Configuration.Endpoints` to enable setting custom endpoints for events and sessions [#366](https://github.com/bugsnag/bugsnag-unity/pull/366) - * Add `Configuration.ProjectPackages` config option to set the [native Android option](https://docs.bugsnag.com/platforms/android/configuration-options/#projectpackages) [#364](https://github.com/bugsnag/bugsnag-unity/pull/364) - * Add `Configuration.BundleVersion` config option to set the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#bundleversion) [#359](https://github.com/bugsnag/bugsnag-unity/pull/359) - * Add `Configuration.AppType` configuration option to enable setting a custom value for the app.type field in an event [#363](https://github.com/bugsnag/bugsnag-unity/pull/363) - * Update bugsnag-cocoa to v6.11.0 - * Add breadcrumbs for `UIScene` notifications. [#1165](https://github.com/bugsnag/bugsnag-cocoa/pull/1165) - * Fix another rare crash in `bsg_ksmachgetThreadQueueName`. [#1157](https://github.com/bugsnag/bugsnag-cocoa/pull/1157) - * Fix ThreadSanitizer data race in `BugsnagBreadcrumbs`. [#1160](https://github.com/bugsnag/bugsnag-cocoa/pull/1160) - * Add `DiscardClasses` configuration option to disable sending events that contain user defined error classes. [#361](https://github.com/bugsnag/bugsnag-unity/pull/361) - * Update bugsnag-android to v5.11.0: * Add Bugsnag listeners for StrictMode violation detection [#1331](https://github.com/bugsnag/bugsnag-android/pull/1331) - * Address pre-existing StrictMode violations [#1328](https://github.com/bugsnag/bugsnag-android/pull/1328) - + ### Deprecated * `Bugsnag.SetContext(string context)` has been deprecated in favour of the new `Bugsnag.Context` property and will be removed in the next major release. - * `Configuration.Endpoint` has been deprecated in favour of the new `Configuration.Endpoints` class and will be removed in the next major release. - -* `Configuration.SessionEndpoint` has been deprecated in favour of the new `Configuration.Endpoints` class and will be removed in the next major release. - -* `Configuration.NotifyReleaseStages` has been deprecated in favour of `Configuration.EnabledReleaseStages` and will be removed in the next major release. +* `Configuration.SessionEndpoint` has been deprecated in favour of the new `Configuration.Endpoints` class and will be removed in the next major release. +* `Configuration.NotifyReleaseStages` has been deprecated in favour of `Configuration.EnabledReleaseStages` and will be removed in the next major release. ## 5.2.0 (2021-08-04) ### Enhancements * Add `AppHangThresholdMillis` to set the [native Cocoa option](https://docs.bugsnag.com/platforms/ios/configuration-options/#apphangthresholdmillis) [#347](https://github.com/bugsnag/bugsnag-unity/pull/347) - * Add `EnabledErrorTypes` configuration option to enable/disable different types of errors [#341](https://github.com/bugsnag/bugsnag-unity/pull/341) - -* [Android] Automatic [App Not Responding](https://developer.android.com/topic/performance/vitals/anr) (ANR) detection is now enabled by default +* [Android] Automatic [App Not Responding](https://developer.android.com/topic/performance/vitals/anr) (ANR) detection is now enabled by default [#339](https://github.com/bugsnag/bugsnag-unity/pull/339) - * Update bugsnag-cocoa to v6.10.2 - * Fix ThreadSanitizer data race warning in `BSGAppHangDetector`. [#1153](https://github.com/bugsnag/bugsnag-cocoa/pull/1153) - * Remove (duplicated) `user` information from `metaData`. [#1151](https://github.com/bugsnag/bugsnag-cocoa/pull/1151) - * Fix a potential stack overflow in `+[BugsnagThread allThreadsWithCurrentThreadBacktrace:]`. [#1148](https://github.com/bugsnag/bugsnag-cocoa/pull/1148) - * Fix `NSNull` handling in `+[BugsnagError errorFromJson:]` and `+[BugsnagStackframe frameFromJson:]`. [#1143](https://github.com/bugsnag/bugsnag-cocoa/pull/1143) - * Fix a rare crash in `bsg_ksmachgetThreadQueueName`. [#1147](https://github.com/bugsnag/bugsnag-cocoa/pull/1147) - * Fix an issue that could cause C++ exceptions with very long descriptions to not be reported. [#1137](https://github.com/bugsnag/bugsnag-cocoa/pull/1137) - * Improve performance of adding metadata by using async file I/O. [#1133](https://github.com/bugsnag/bugsnag-cocoa/pull/1133) - * Improve performance of leaving breadcrumbs by using async file I/O. [#1124](https://github.com/bugsnag/bugsnag-cocoa/pull/1124) - * Prevent some potential false positive detection of app hangs. [#1122](https://github.com/bugsnag/bugsnag-cocoa/pull/1122) - * Update bugsnag-android to v5.10.1: - * Prefer `calloc()` to `malloc()` in NDK code [#1320](https://github.com/bugsnag/bugsnag-android/pull/1320) - * Ensure correct value always collected for activeScreen [#1322](https://github.com/bugsnag/bugsnag-android/pull/1322) - * Capture process name in Event payload [#1318](https://github.com/bugsnag/bugsnag-android/pull/1318) - * Avoid unnecessary BroadcastReceiver registration for monitoring device orientation [#1303](https://github.com/bugsnag/bugsnag-android/pull/1303) - * Register system callbacks on background thread [#1292](https://github.com/bugsnag/bugsnag-android/pull/1292) - * Fix rare NullPointerExceptions from ConnectivityManager [#1311](https://github.com/bugsnag/bugsnag-android/pull/1311) - * Respect manual setting of context [#1310](https://github.com/bugsnag/bugsnag-android/pull/1310) - * Handle interrupt when shutting down executors [#1315](https://github.com/bugsnag/bugsnag-android/pull/1315) - * Allow serializing enabledBreadcrumbTypes as null [#1316](https://github.com/bugsnag/bugsnag-android/pull/1316) - * Properly handle ANRs after multiple calls to autoNotify and autoDetectAnrs [#1265](https://github.com/bugsnag/bugsnag-android/pull/1265) - * Cache value of app.backgroundWorkRestricted [#1275](https://github.com/bugsnag/bugsnag-android/pull/1275) - * Optimize execution of callbacks [#1276](https://github.com/bugsnag/bugsnag-android/pull/1276) - * Optimize implementation of internal state change observers [#1274](https://github.com/bugsnag/bugsnag-android/pull/1274) - * Optimize metadata implementation by reducing type casts [#1277](https://github.com/bugsnag/bugsnag-android/pull/1277) - * Trim stacktraces to <200 frames before attempting to construct POJOs [#1281](https://github.com/bugsnag/bugsnag-android/pull/1281) - * Use direct field access when adding breadcrumbs and state updates [#1279](https://github.com/bugsnag/bugsnag-android/pull/1279) - * Avoid using regex to validate api key [#1282](https://github.com/bugsnag/bugsnag-android/pull/1282) - * Discard unwanted automatic data earlier where possible [#1280](https://github.com/bugsnag/bugsnag-android/pull/1280) - * Enable ANR handling on immediately if started from the main thread [#1283](https://github.com/bugsnag/bugsnag-android/pull/1283) - * Include `app.binaryArch` in all events [#1287](https://github.com/bugsnag/bugsnag-android/pull/1287) - * Cache results from PackageManager [#1288](https://github.com/bugsnag/bugsnag-android/pull/1288) - * Use ring buffer to store breadcrumbs [#1286](https://github.com/bugsnag/bugsnag-android/pull/1286) - * Avoid expensive set construction in Config constructor [#1289](https://github.com/bugsnag/bugsnag-android/pull/1289) - * Replace calls to String.format() with concatenation [#1293](https://github.com/bugsnag/bugsnag-android/pull/1293) - * Optimize capture of thread traces - [#1300](https://github.com/bugsnag/bugsnag-android/pull/1300) - + [#1300](https://github.com/bugsnag/bugsnag-android/pull/1300) + ### Bug fixes -* Fixed an issue where Windows events would have incorrectly split stacktraces resulting in all lines being bundled into one +* Fixed an issue where Windows events would have incorrectly split stacktraces resulting in all lines being bundled into one [#350](https://github.com/bugsnag/bugsnag-unity/pull/350) - -* Fixed an issue where WebGL web requests that initially fail were not respecting the 10 second delay before retrying +* Fixed an issue where WebGL web requests that initially fail were not respecting the 10 second delay before retrying [#321](https://github.com/bugsnag/bugsnag-unity/pull/321) - * Fixed an issue where Breadcrumbs were reported in the wrong order on Windows and in the Unity Editor [#322](https://github.com/bugsnag/bugsnag-unity/pull/322) - * Fixed an issue where a "Bugsnag loaded" breadcrumb was not added on Windows, Linux, WebGL, and editor builds [#327](https://github.com/bugsnag/bugsnag-unity/pull/327) - * Fixed an issue where the fallback was not reporting the correct app.type [#325](https://github.com/bugsnag/bugsnag-unity/pull/325) - + ### Deprecated * `Configuration.NotifyLevel` has been deprecated in favour of `Configuration.NotifyLogLevel` and will be removed in the next major release. - * `Configuration.AutoNotify` has been deprecated in favour of `Configuration.AutoDetectErrors` and will be removed in the next major release. - * `Configuration.AutoCaptureSessions` has been deprecated in favour of `Configuration.AutoTrackSessions` and will be removed in the next major release. - ## 5.1.1 (2021-06-24) @@ -718,31 +633,23 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A * `unity.osLanguage` -> `device.osLanguage` * `unity.unityException` -> removed as a duplicate of the error class * `unity.unityLogType` -> removed as is contained in the error class for generic logs - * Add `EnabledBreadcrumbTypes` configuration option to enable/disable automatically recorded breadcrumbs [#301](https://github.com/bugsnag/bugsnag-unity/pull/301) * Add `MaxBreadcrumbs` configuration option to control the number of breadcrumbs collected on all platforms [#275](https://github.com/bugsnag/bugsnag-unity/pull/275) [#304](https://github.com/bugsnag/bugsnag-unity/pull/304) - * Update bugsnag-cocoa to v6.9.6: - * Improve accuracy of app hang event information to better reflect state at time of detection. [#1118](https://github.com/bugsnag/bugsnag-cocoa/pull/1118) - * Stop app hangs being reported if app is launched in the background. [#1112](https://github.com/bugsnag/bugsnag-cocoa/pull/1112) - * Stop session being reported if app is launched in the background. [#1107](https://github.com/bugsnag/bugsnag-cocoa/pull/1107) - * Fix KSCrash state storage for apps with no CFBundleName. [#1103](https://github.com/bugsnag/bugsnag-cocoa/pull/1103) - * Improve performance of `notify()`. [#1102](https://github.com/bugsnag/bugsnag-cocoa/pull/1102) [#1104](https://github.com/bugsnag/bugsnag-cocoa/pull/1104) [#1105](https://github.com/bugsnag/bugsnag-cocoa/pull/1105) - * Fix a crash in `-[BugsnagApp deserializeFromJson:]` if main Mach-O image could not be identified, and improve reliability of identification. [#1097](https://github.com/bugsnag/bugsnag-cocoa/issues/1097) [#1101](https://github.com/bugsnag/bugsnag-cocoa/pull/1101) @@ -751,29 +658,22 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A * Fix an issue where the Device.time of an event was missing the milliseconds [#298](https://github.com/bugsnag/bugsnag-unity/pull/298) - * Adjust post build script to support Unity 2021 builds [#289](https://github.com/bugsnag/bugsnag-unity/pull/289) - * Fix an issue where timestamps and other `:`-containing log message content was interpreted as the error class [#292](https://github.com/bugsnag/bugsnag-unity/pull/292) - * Correct Android session start times [#291](https://github.com/bugsnag/bugsnag-unity/pull/291) - * Fix duplicate events being sent for Android C/C++ crashes - + ## 5.0.0 (2021-06-08) This version contains **breaking** changes, as bugsnag-unity has been updated to use the latest available versions of bugsnag-android (v4.22.2 -> v5.9.4) and bugsnag-cocoa (v5.23.5 -> v6.9.3). - Please see the [upgrade guide](./UPGRADING.md) for details of all the changes and instructions on how to upgrade. - ### Bug fixes * Stop scene changes overrriding context when manually set [#255](https://github.com/bugsnag/bugsnag-unity/pull/255) - * Don't Destroy TimingTrackerObject, so it persists across scenes [#239](https://github.com/bugsnag/bugsnag-unity/pull/239) @@ -804,7 +704,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * Avoid JNI crash in leaveBreadcrumb by pushing local frame [#214](https://github.com/bugsnag/bugsnag-unity/pull/214) - * Respect autoNotify flag on Android [#207](https://github.com/bugsnag/bugsnag-unity/pull/207) @@ -814,35 +713,27 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * Add device id to error reports on Cocoa platforms [#203](https://github.com/bugsnag/bugsnag-unity/pull/203) - * Update bugsnag-cocoa to v5.23.5: - * Fix JSON serialisation of strings with control characters [#739](https://github.com/bugsnag/bugsnag-cocoa/pull/739) - * Removed non-thread safe date formatter [#758](https://github.com/bugsnag/bugsnag-cocoa/pull/758) - * Avoid dereference null pointer in JSON serialisation [#637](https://github.com/bugsnag/bugsnag-cocoa/pull/637) [Naugladur](https://github.com/Naugladur) - * Fixed an issue where an app could deadlock during a crash if unfavourable timing caused DYLD lock contention. [#580](https://github.com/bugsnag/bugsnag-cocoa/pull/580) [#675](https://github.com/bugsnag/bugsnag-cocoa/pull/675) [#725](https://github.com/bugsnag/bugsnag-cocoa/pull/725) [#721](https://github.com/bugsnag/bugsnag-cocoa/pull/721) - * Fix possible report corruption when using `notify()` from multiple threads when configured to skip capturing/reporting background thread contents (generally only Unity games). [#442](https://github.com/bugsnag/bugsnag-cocoa/pull/442) - * Added several additional event fields (`codeBundleId`, `osName`, `modelNumber`, `locale`) that were missing from the OOM reports. [#444](https://github.com/bugsnag/bugsnag-cocoa/pull/444) - * Bugsnag now correctly records a new session if it is returning to the foreground after more than 60 seconds in the background. [#529](https://github.com/bugsnag/bugsnag-cocoa/pull/529) @@ -853,7 +744,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an * Delete local JNI references to avoid leaks [#198](https://github.com/bugsnag/bugsnag-unity/pull/198) - * Add option to `Configuration` to prevent automatic breadcrumb collection [#199](https://github.com/bugsnag/bugsnag-unity/pull/199) @@ -877,7 +767,6 @@ Please see the [upgrade guide](./UPGRADING.md) for details of all the changes an This release adds ANR detection for Unity apps running in Android. To enable this option you should set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag in the normal way. - * Detect ANRs on Android and provide configuration option to enable detection [#184](https://github.com/bugsnag/bugsnag-unity/pull/184) @@ -889,16 +778,12 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag ## 4.7.0 (2020-01-22) * Update bugsnag-android to v4.22.2: - * This release adds a compile-time dependency on the Kotlin standard library. This should not affect the use of any API supplied by bugsnag-unity. - * Modularise bugsnag-android into Core, NDK, and ANR artifacts [#522](https://github.com/bugsnag/bugsnag-android/pull/522) - * Migrate dependencies to androidx [#554](https://github.com/bugsnag/bugsnag-android/pull/554) - * Report internal SDK errors to bugsnag [#570](https://github.com/bugsnag/bugsnag-android/pull/570) [#581](https://github.com/bugsnag/bugsnag-android/pull/581) @@ -906,48 +791,36 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag [#605](https://github.com/bugsnag/bugsnag-android/pull/605) [#588](https://github.com/bugsnag/bugsnag-android/pull/588) [#612](https://github.com/bugsnag/bugsnag-android/pull/612) - * Add `detectNdkCrashes` configuration option to bugsnag-android to toggle whether C/C++ crashes are detected [#491](https://github.com/bugsnag/bugsnag-android/pull/491) - * Use NetworkCallback to monitor connectivity changes on newer API levels [#501](https://github.com/bugsnag/bugsnag-android/pull/501) - * Fix deserialization of custom stackframe fields in cached error reports [#576](https://github.com/bugsnag/bugsnag-android/pull/576) - * Buffer IO when reading from cached error files, improving SDK performance [#573](https://github.com/bugsnag/bugsnag-android/pull/573) - * flushOnLaunch() does not cancel previous requests if they timeout, leading to potential duplicate reports [#593](https://github.com/bugsnag/bugsnag-android/pull/593) - * Report correct value for free disk space [#589](https://github.com/bugsnag/bugsnag-android/pull/589) - * Allow overriding the versionCode via Configuration [#610](https://github.com/bugsnag/bugsnag-android/pull/610) - * Catch throwables when invoking methods on system services [#623](https://github.com/bugsnag/bugsnag-android/pull/623) - * Update bugsnag-cocoa to v5.23.0: * Fix unrecognized selector crash when adding metadata [#430](https://github.com/bugsnag/bugsnag-cocoa/pull/430) - * This release removes support for reporting 'partial' or 'minimal' crash reports where the crash report could not be entirely written (due to disk space or other issues like the device battery dying). While sometimes the reports could point in the right direction for debugging, they could also be confusing or not enough information to pursue and close the issue successfully. - This release also renames a few configuration properties to align better with the intended use and other Bugsnag libraries, so people who use more than one platform can easily find related functionality in a different library. The old names are deprecated but still supported until the next major release. [#435](https://github.com/bugsnag/bugsnag-cocoa/pull/435) - * `Bugsnag.setBreadcrumbCapacity()` is now `setMaxBreadcrumbs()` on the `BugsnagConfiguration` class. In addition, the default number of breadcrumbs saved has been raised to 25 and limited to no more than 100. @@ -1022,13 +895,10 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag * Support disabling native reporting during initialization [#164](https://github.com/bugsnag/bugsnag-unity/pull/164) - The new API can be used as follows: - ```c# Bugsnag.Init("your-api=key-here", false /* disable crash reporting */); ``` - or by unchecking "Auto Notify" when initializing Bugsnag via a GameObject in the Unity Inspector. @@ -1145,14 +1015,11 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag * Migrate version information in reports to device.runtimeVersions, adding additional info like scripting backend [#149](https://github.com/bugsnag/bugsnag-unity/pull/149) - * Update bugsnag-android dependency to v4.14.0: * Improve In-foreground calculation for report metadata [#466](https://github.com/bugsnag/bugsnag-android/pull/466) - * Migrate version information to device.runtimeVersions [#472](https://github.com/bugsnag/bugsnag-android/pull/472) - * Update bugsnag-cocoa dependency to v5.22.0: * Migrate version information to device.runtimeVersions [#340](https://github.com/bugsnag/bugsnag-cocoa/pull/340) @@ -1194,7 +1061,6 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag main thread-only `logMessageReceived` callback receives more stackframes on some versions of Unity 2017, improving the debugging experience. - ## 4.4.0 (2019-04-05) ### Enhancements @@ -1202,10 +1068,8 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag * Update bugsnag-android dependency to v4.13.0: * Add ANR detection to bugsnag-android (ANR detection is disabled on Unity) [bugsnag-android#442](https://github.com/bugsnag/bugsnag-android/pull/442) - * Add unhandled_events field to native payload [bugsnag-android#445](https://github.com/bugsnag/bugsnag-android/pull/445) - * Add stopSession() and resumeSession() to Client [bugsnag-android#429](https://github.com/bugsnag/bugsnag-android/pull/429) @@ -1214,16 +1078,12 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag * Update bugsnag-android dependency to v4.13.0: * Prevent overwriting config.projectPackages if already set [bugsnag-android#428](https://github.com/bugsnag/bugsnag-android/pull/428) - * Fix incorrect session handledCount when notifying in quick succession [bugsnag-android#434](https://github.com/bugsnag/bugsnag-android/pull/434) - * Ensure boolean object from map serialised as boolean primitive in JNI [bugsnag-android#452](https://github.com/bugsnag/bugsnag-android/pull/452) - * Prevent NPE occurring when calling resumeSession() [bugsnag-android#444](https://github.com/bugsnag/bugsnag-android/pull/444) - * Update bugsnag-cocoa dependency to v5.19.1: * Fix generating an incorrect stacktrace used when logging an exception to Bugsnag from a location other than the original call site (for example, from a @@ -1234,7 +1094,6 @@ set `Bugsnag.Configuration.AutoDetectAnrs` to `true` after initialising bugsnag reporting the handler code stacktrace rather than the reported exception stack. [bugsnag-cocoa#334](https://github.com/bugsnag/bugsnag-cocoa/pull/334) - * Fix network connectivity monitor by connecting to the correct domain [Jacky Wijaya](https://github.com/Jekiwijaya) [bugsnag-cocoa#332](https://github.com/bugsnag/bugsnag-cocoa/pull/332) @@ -1245,12 +1104,10 @@ This release is the first to distribute Unity packages with and without 64-bit ABI libraries for Android. In most cases, `Bugsnag.unitypackage` is the correct package to use, as by default most Unity Android apps only can use 32-bit binaries. - ### Enhancements * Add StopSession() and ResumeSession() to public API [#136](https://github.com/bugsnag/bugsnag-unity/pull/136) - * Update bugsnag-android dependency to v4.11.0: * Add stopSession() and resumeSession() to Client [bugsnag-android#429](https://github.com/bugsnag/bugsnag-android/pull/429) @@ -1258,7 +1115,6 @@ binaries. [bugsnag-android#428](https://github.com/bugsnag/bugsnag-android/pull/428) * Fix incorrect session handledCount when notifying in quick succession [bugsnag-android#434](https://github.com/bugsnag/bugsnag-android/pull/434) - * Update bugsnag-cocoa dependency to v5.19.0: * Add stopSession() and resumeSession() to Bugsnag [bugsnag-cocoa#325](https://github.com/bugsnag/bugsnag-cocoa/pull/325) @@ -1272,13 +1128,10 @@ binaries. [#138](https://github.com/bugsnag/bugsnag-unity/pull/138) [bugsnag-cocoa#333](https://github.com/bugsnag/bugsnag-cocoa/pull/333) [bugsnag-android#439](https://github.com/bugsnag/bugsnag-android/pull/439) - * [Android] Remove references to 64-bit ABIs included in the package [#139](https://github.com/bugsnag/bugsnag-unity/pull/139) - * Make `ErrorClass` and `ErrorMessage` mutable on `Exception`. This allows for modifying both properties from callbacks: - ```cs Bugsnag.Notify(exception, report => { report.Exceptions[0].ErrorClass = "CustomException"; @@ -1286,7 +1139,6 @@ binaries. }); ``` [#140](https://github.com/bugsnag/bugsnag-unity/pull/140) - * Set severity reason when manually specifying severity as a parameter to `Notify()`. This sets the correct reason for the severity selection on the dashboard. @@ -1322,7 +1174,6 @@ binaries. * Ensure configuration options are synced with native layer [#124](https://github.com/bugsnag/bugsnag-unity/pull/124) - * Add retry delays after delivery failure to stop excess logging [#126](https://github.com/bugsnag/bugsnag-unity/pull/126) @@ -1354,7 +1205,6 @@ Update bugsnag-android dependency to v4.11.0: * Update dependent libraries: * bugsnag-cocoa v5.17.3 * bugsnag-android v4.10.0 - ### Enhancements * Add a configuration option for allowing Unity exceptions to reduce a project's @@ -1374,7 +1224,6 @@ This is a new major release with many features and fixes. See the [upgrade guide](https://github.com/bugsnag/bugsnag-unity/blob/master/UPGRADING.md) for more information on how to update your integration, or the [integration guide](https://docs.bugsnag.com/platforms/unity/) to get started. - ### Enhancements * Unity/C# errors are now automatically detected and reported on Windows and any @@ -1393,15 +1242,12 @@ guide](https://docs.bugsnag.com/platforms/unity/) to get started. | [#94](https://github.com/bugsnag/bugsnag-unity/pull/94) * Report app information in WebGL: `duration`, `inForeground` and `durationInForeground` | [#94](https://github.com/bugsnag/bugsnag-unity/pull/94) - **Note:** During the preparation for this release we noticed a workflow issue when targeting tvOS. In order to successfully build for tvOS, after importing the Bugsnag plugin there is a manual step required: - - In the Unity editor, go to Project > Assets > iOS > Bugsnag - Select all source files in this directory - In the inspector pane check `tvOS` in the "Include platforms" list - Click the "Apply" button at the bottom of the inspector pane - We'll work on making this install process smoother in the future. ## 3.6.6 (2018-05-24) @@ -1420,7 +1266,6 @@ We'll work on making this install process smoother in the future. - Ensure timezone is serialised in report payload. [#248](https://github.com/bugsnag/bugsnag-cocoa/pull/248) [Jamie Lynch](https://github.com/fractalwrench) - * Upgrade bugsnag-android to v4.3.4: - *Bug Fixes:* - Avoid adding extra comma separator in JSON if File input is empty or null [#284](https://github.com/bugsnag/bugsnag-android/pull/284) @@ -1440,7 +1285,6 @@ We'll work on making this install process smoother in the future. ## 3.6.4 (2018-02-21) * (iOS) Fix error message displayed when thread tracing disabled - * Update dependent libraries: * bugsnag-cocoa v5.15.4 * bugsnag-android v4.3.1 @@ -1469,6 +1313,7 @@ We'll work on making this install process smoother in the future. app health ## 3.5.5 (2017-11-30) + * (iOS) Fix encoding of control characters in crash reports. Ensures crash reports are written correctly and delivered when containing U+0000 - U+001F @@ -1497,7 +1342,6 @@ written correctly and delivered when containing U+0000 - U+001F ## 3.5.0 (2017-02-10) * Track whether an error is handled or unhandled - * Update native libraries ## 3.4.0 (2017-19-09) @@ -1506,11 +1350,9 @@ written correctly and delivered when containing U+0000 - U+001F * Improve error grouping by standardizing log message format [#45](https://github.com/bugsnag/bugsnag-unity/pull/45) - * Add breadcrumbs for scene changes [Jamie Lynch](https://github.com/fractalwrench) [#54](https://github.com/bugsnag/bugsnag-unity/pull/54) - * Load WebGL extension locally, negating the need for a separate request [#46](https://github.com/bugsnag/bugsnag-unity/pull/46) @@ -1621,7 +1463,6 @@ written correctly and delivered when containing U+0000 - U+001F This release includes significant updates to the underlying android and cocoa libraries. - ### Enhancements * Add support for WebGL @@ -1629,7 +1470,6 @@ libraries. * Add support for setting user metadata * Add support for setting app version * Add support for setting breadcrumbs - * Upgrade bugsnag-android from 3.2.5 -> 3.4.0 * Upgrade bugsnag-cocoa from 4.0.7 -> 4.1.0 @@ -1638,54 +1478,36 @@ libraries. * Fix crash resulting from use of deprecated method [Simon Maynard](https://github.com/snmaynard) [#13](https://github.com/bugsnag/bugsnag-unity/pull/13) - * Update callback registration method to remove deprecations [Delisa Mason](https://github.com/kattrali) [#20](https://github.com/bugsnag/bugsnag-unity/pull/20) - 2.2.6 ----- - - Fix compilation under arm64 - 2.2.5 ----- - - Allow passing Context as a second argument to Bugsnag.Notify - 2.2.4 ----- - - Fix use-after-free on NSNotification - 2.2.3 ----- - - Make context thread safe too - 2.2.2 ----- - - Make metaData thread safe - 2.2.1 ----- - - Improve speed during manual notifies on android and ios. - 2.2.0 ----- - - Fix LogHandler in non-debug builds. - Make Bugsnag methods static. - Fix crashes caused by passing unexpected nulls into Bugsnag. - 2.1.0 ----- - - Fix stacktrace generation in Bugsnag.Notify() on unthrown exceptions. - 2.0.0 ----- - - Rewrite to use bugsnag-android and bugsnag-ios. + diff --git a/Rakefile b/Rakefile index 26f49afaf..93f00b67a 100644 --- a/Rakefile +++ b/Rakefile @@ -133,15 +133,15 @@ def assemble_android filter_abis=true # copy unity lib unity_lib = File.join("bugsnag-android-unity", "build", "outputs", "aar", "bugsnag-android-unity-release.aar") - FileUtils.cp android_core_lib, File.join(android_dir, "bugsnag-android-release.aar") - FileUtils.cp ndk_lib, File.join(android_dir, "bugsnag-android-ndk-release.aar") + FileUtils.cp ndk_lib, File.join(android_dir, "bugsnag-plugin-android-ndk-release.aar") FileUtils.cp anr_lib, File.join(android_dir, "bugsnag-plugin-android-anr-release.aar") FileUtils.cp unity_lib, File.join(android_dir, "bugsnag-android-unity-release.aar") FileUtils.mkdir File.join(android_dir, "Kotlin") FileUtils.cp kotlin_stdlib, File.join(android_dir, "Kotlin/kotlin-stdlib.jar") FileUtils.cp kotlin_stdlib_common, File.join(android_dir, "Kotlin/kotlin-stdlib-common.jar") FileUtils.cp kotlin_annotations, File.join(android_dir, "Kotlin/kotlin-annotations.jar") + end namespace :plugin do diff --git a/UPGRADING.md b/UPGRADING.md index a0c622661..9430c9daa 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1,6 +1,14 @@ Upgrading ========= +## 7.x to 8.x + +`Configuration.DiscardClasses` and `Configuration.RedactedKeys` are now [Regex](https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex?view=net-8.0) collections instead of string collections. This allows developers to have more control over how they perform. + +If you are using the `DiscardClasses` and `RedactedKeys` sections of the Bugsnag Unity Configuration Window, you can enter Regex patterns as strings and they will be converted into Regex objects when the Bugsnag SDK is started. + +`Event.Unhandled` (accessed via OnError and OnSend callbacks) is now non-nullable. + ## 6.x to 7.x When building using Unity 2019+, the Bugsnag SDK now uses a new method to intercept uncaught C# exceptions. This allows us access to the original exception object, meaning more accurate exception data and full support for inner exceptions. diff --git a/android-libs/org.jetbrains.kotlin.kotlin-stdlib-1.5.10.jar b/android-libs/org.jetbrains.kotlin.kotlin-stdlib-1.5.10.jar new file mode 100644 index 000000000..5015b3a03 Binary files /dev/null and b/android-libs/org.jetbrains.kotlin.kotlin-stdlib-1.5.10.jar differ diff --git a/android-libs/org.jetbrains.kotlin.kotlin-stdlib-common-1.5.10.jar b/android-libs/org.jetbrains.kotlin.kotlin-stdlib-common-1.5.10.jar new file mode 100644 index 000000000..7999449e8 Binary files /dev/null and b/android-libs/org.jetbrains.kotlin.kotlin-stdlib-common-1.5.10.jar differ diff --git a/bugsnag-android b/bugsnag-android index f9a1219d1..594600185 160000 --- a/bugsnag-android +++ b/bugsnag-android @@ -1 +1 @@ -Subproject commit f9a1219d11db0c02134d692c7ca3a1765281c0df +Subproject commit 59460018551750dfcce4fd4e9f612eae7826559e diff --git a/bugsnag-cocoa b/bugsnag-cocoa index 49f60b8dc..16b9145fc 160000 --- a/bugsnag-cocoa +++ b/bugsnag-cocoa @@ -1 +1 @@ -Subproject commit 49f60b8dc2e94e7ede1114e2c39ba6ac0b576f42 +Subproject commit 16b9145fc66e5296f16e733f6feb5d0e450574e8 diff --git a/build.cake b/build.cake index f85a1a27f..faf9b5b5e 100644 --- a/build.cake +++ b/build.cake @@ -5,7 +5,7 @@ var target = Argument("target", "Default"); var solution = File("./BugsnagUnity.sln"); var configuration = Argument("configuration", "Release"); var project = File("./src/BugsnagUnity/BugsnagUnity.csproj"); -var version = "7.7.6"; +var version = "8.0.0"; Task("Restore-NuGet-Packages") .Does(() => NuGetRestore(solution)); diff --git a/features/csharp/csharp_config.feature b/features/csharp/csharp_config.feature index 890a07fc3..5954f26d0 100644 --- a/features/csharp/csharp_config.feature +++ b/features/csharp/csharp_config.feature @@ -115,7 +115,7 @@ Feature: csharp events And the event "breadcrumbs.1.metaData.dictionary.stringArray.0" equals "12345678901234567890***80 CHARS TRUNCATED***" And the event "breadcrumbs.1.metaData.stringDictionary.testKey" equals "12345678901234567890***80 CHARS TRUNCATED***" - @skip_cocoa @skip_android #not supported on these platforms + @skip_cocoa #not supported on these platforms Scenario: GenerateAnonymousId When I run the game in the "GenerateAnonymousId" state And I wait to receive an error diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs index cb70f5e41..f124b5a58 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenario.cs @@ -38,6 +38,10 @@ public virtual void PrepareConfig(string apiKey, string host) Configuration.DotnetScriptingRuntime = FindDotnetScriptingRuntime(); Configuration.DotnetApiCompatibility = FindDotnetApiCompatibility(); Configuration.AutoTrackSessions = false; + if (Application.platform == RuntimePlatform.IPhonePlayer) + { + Configuration.EnabledErrorTypes.OOMs = false; + } } public void AddSwitchConfigValues(SwitchCacheType switchCacheType, int switchCacheIndex, string switchMountName) diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/DiscardErrorClass.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/DiscardErrorClass.cs index 6202bcb8d..8f9a291ec 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/DiscardErrorClass.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/DiscardErrorClass.cs @@ -1,11 +1,13 @@ -using BugsnagUnity; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using BugsnagUnity; public class DiscardErrorClass : Scenario { public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - Configuration.DiscardClasses = new string[] { "IndexOutOfRangeException" }; + Configuration.DiscardClasses = new List<Regex> { new Regex("IndexOutOfRangeException") }; } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/RedactedKeys.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/RedactedKeys.cs index 8d7198446..354ad9c1b 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/RedactedKeys.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Config/RedactedKeys.cs @@ -1,9 +1,12 @@ -public class RedactedKeys : Scenario +using System.Collections.Generic; +using System.Text.RegularExpressions; + +public class RedactedKeys : Scenario { public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - Configuration.RedactedKeys = new string[] { "testKey" }; + Configuration.RedactedKeys = new List<Regex> { new Regex("testKey") }; Configuration.AddMetadata("testSection","testKey","testValue"); } diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs index 3f5df4a53..161f20241 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/CorruptedCacheFile.cs @@ -9,10 +9,6 @@ public class CorruptedCacheFile : Scenario public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs index 9023134f6..6e744c32a 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/MaxPersistEvents.cs @@ -9,10 +9,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.MaxPersistedEvents = 3; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs index 49fc9f75a..fe3bdb812 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistDeviceId.cs @@ -5,10 +5,6 @@ public class PersistDeviceId : Scenario public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs index 039d3c9b9..02f553ed8 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEvent.cs @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.Context = "Error 1"; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs index 8f7206ce3..b55201d45 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReport.cs @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host) { base.PrepareConfig(apiKey, host); Configuration.Context = "Error 2"; - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs index 1764b9297..cc7397822 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/PersistEventReportCallback.cs @@ -26,10 +26,6 @@ public override void PrepareConfig(string apiKey, string host) return true; }); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } public override void Run() diff --git a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs index 7a22bdbda..474a28579 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Scenarios/Csharp/Persistence/ReportMaxPersistedEvents.cs @@ -10,10 +10,6 @@ public override void PrepareConfig(string apiKey, string host) { _eventsCorrect = CheckForEvents(); base.PrepareConfig(apiKey, host); - if (Application.platform == RuntimePlatform.IPhonePlayer) - { - Configuration.EnabledErrorTypes.OOMs = false; - } } private bool CheckForEvents() diff --git a/features/ios/ios_native_errors.feature b/features/ios/ios_native_errors.feature index 9d6ed2a8e..1a1ebd2fc 100644 --- a/features/ios/ios_native_errors.feature +++ b/features/ios/ios_native_errors.feature @@ -8,8 +8,7 @@ Feature: iOS Native Errors And I wait for 2 seconds And On Mobile I relaunch the app And I run the game in the "StartSDKDefault" state - And I wait to receive an error - And the exception "message" equals "The app was likely terminated by the operating system while in the foreground" + And I should receive no errors Scenario: Last Run Info When I run the game in the "IosNativeException" state diff --git a/features/support/env.rb b/features/support/env.rb index 7f55fd1b7..dc450ff05 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -64,8 +64,6 @@ BeforeAll do $api_key = 'a35a2a72bd230ac0aa0f52715bbdc6aa' - Maze.config.enforce_bugsnag_integrity = false - if Maze.config.os&.downcase == 'macos' # The default macOS Crash Reporter "#{app_name} quit unexpectedly" alert grabs focus which can cause tests to flake. # This option, which appears to have been introduced in macOS 10.11, displays a notification instead of the alert. @@ -113,6 +111,14 @@ end end +Before do |scenario| + # Detect if we're running the webgl tests + if Maze.config.farm.to_s.eql?('local') + # Allows each scenario to auto retry once due to instability in the local browser + scenario.tags << Cucumber::Core::Test::Tag.new(nil, '@retry') + end +end + After do |scenario| next if scenario.status == :skipped diff --git a/src/Assets/Bugsnag/Editor/BugsnagEditor.cs b/src/Assets/Bugsnag/Editor/BugsnagEditor.cs index 2da7b042e..fd598d838 100644 --- a/src/Assets/Bugsnag/Editor/BugsnagEditor.cs +++ b/src/Assets/Bugsnag/Editor/BugsnagEditor.cs @@ -164,6 +164,7 @@ private void DrawAdvancedSettings(SerializedObject so, BugsnagSettingsObject set } EditorGUILayout.PropertyField(so.FindProperty("AutoDetectErrors")); EditorGUILayout.PropertyField(so.FindProperty("AutoTrackSessions")); + EditorGUILayout.PropertyField(so.FindProperty("GenerateAnonymousId")); EditorGUILayout.PropertyField(so.FindProperty("BreadcrumbLogLevel")); EditorGUILayout.PropertyField(so.FindProperty("Context")); EditorGUILayout.PropertyField(so.FindProperty("DiscardClasses")); diff --git a/src/Assets/Bugsnag/Scripts/BugsnagSettingsObject.cs b/src/Assets/Bugsnag/Scripts/BugsnagSettingsObject.cs index 6d53316de..dbf1f9b91 100644 --- a/src/Assets/Bugsnag/Scripts/BugsnagSettingsObject.cs +++ b/src/Assets/Bugsnag/Scripts/BugsnagSettingsObject.cs @@ -34,7 +34,7 @@ public class BugsnagSettingsObject : ScriptableObject public bool PersistUser = true; public string SessionEndpoint = "https://sessions.bugsnag.com"; public ThreadSendPolicy SendThreads = ThreadSendPolicy.UnhandledOnly; - public string[] RedactedKeys = new string[] { "password" }; + public string[] RedactedKeys = new string[] { ".*password.*" }; public string ReleaseStage; public bool ReportExceptionLogsAsHandled = true; public bool SendLaunchCrashesSynchronously = true; @@ -42,6 +42,7 @@ public class BugsnagSettingsObject : ScriptableObject public List<TelemetryType> Telemetry = new List<TelemetryType> { TelemetryType.InternalErrors, TelemetryType.Usage }; public int VersionCode = -1; + public bool GenerateAnonymousId = true; public SwitchCacheType SwitchCacheType = SwitchCacheType.R; public string SwitchCacheMountName = "BugsnagCache"; public int SwitchCacheIndex = 0; @@ -79,7 +80,16 @@ public Configuration GetConfig() config.BreadcrumbLogLevel = GetLogTypeFromLogLevel( BreadcrumbLogLevel ); config.Context = Context; - config.DiscardClasses = DiscardClasses; + foreach(string discardedClass in DiscardClasses){ + try + { + config.DiscardClasses.Add(new System.Text.RegularExpressions.Regex(discardedClass)); + } + catch (ArgumentException e) + { + Debug.LogError("Invalid Regex pattern for discard class: " + e.Message); + } + } if (EnabledReleaseStages != null && EnabledReleaseStages.Length > 0) { config.EnabledReleaseStages = EnabledReleaseStages; @@ -98,7 +108,17 @@ public Configuration GetConfig() { config.Endpoints = new EndpointConfiguration(NotifyEndpoint, SessionEndpoint); } - config.RedactedKeys = RedactedKeys; + foreach(string key in RedactedKeys) + { + try + { + config.RedactedKeys.Add(new System.Text.RegularExpressions.Regex(key)); + } + catch (ArgumentException e) + { + Debug.LogError("Invalid Regex pattern for redacted key: " + e.Message); + } + } if (string.IsNullOrEmpty(ReleaseStage)) { config.ReleaseStage = Debug.isDebugBuild ? "development" : "production"; @@ -113,7 +133,7 @@ public Configuration GetConfig() config.SecondsPerUniqueLog = TimeSpan.FromSeconds(SecondsPerUniqueLog); config.Telemetry = Telemetry; config.VersionCode = VersionCode; - + config.GenerateAnonymousId = GenerateAnonymousId; config.SwitchCacheType = SwitchCacheType; config.SwitchCacheIndex = SwitchCacheIndex; config.SwitchCacheMaxSize = SwitchCacheMaxSize; diff --git a/src/BugsnagUnity/Bugsnag.cs b/src/BugsnagUnity/Bugsnag.cs index 065e8c06a..8a4df502c 100644 --- a/src/BugsnagUnity/Bugsnag.cs +++ b/src/BugsnagUnity/Bugsnag.cs @@ -71,7 +71,13 @@ public static bool IsStarted() /// the tracking of in foreground time for the application. /// </summary> /// <param name="inFocus"></param> - public static void SetApplicationState(bool inFocus) => Client.SetApplicationState(inFocus); + public static void SetApplicationState(bool inFocus) + { + if(Client != null) + { + Client.SetApplicationState(inFocus); + } + } /// <summary> /// Bugsnag uses the concept of contexts to help display and group your errors. diff --git a/src/BugsnagUnity/Configuration.cs b/src/BugsnagUnity/Configuration.cs index 63f3a4921..3f624291e 100644 --- a/src/BugsnagUnity/Configuration.cs +++ b/src/BugsnagUnity/Configuration.cs @@ -4,6 +4,7 @@ using System.Linq; using BugsnagUnity.Payload; using UnityEngine; +using System.Text.RegularExpressions; namespace BugsnagUnity { @@ -32,7 +33,7 @@ public class Configuration : IMetadataEditor, IFeatureFlagStore public string BundleVersion; - public string[] RedactedKeys = new string[] { "password" }; + public int VersionCode = -1; @@ -54,15 +55,35 @@ public class Configuration : IMetadataEditor, IFeatureFlagStore internal OrderedDictionary FeatureFlags = new OrderedDictionary(); + + public List<Regex> RedactedKeys = new List<Regex>{new Regex(".*password.*",RegexOptions.IgnoreCase)}; public bool KeyIsRedacted(string key) { - if (RedactedKeys == null || RedactedKeys.Length == 0) + if (RedactedKeys == null) + { + return false; + } + foreach (var regex in RedactedKeys) + { + if (regex.IsMatch(key)) + { + return true; + } + } + return false; + } + + public List<Regex> DiscardClasses = new List<Regex>(); + + internal bool ErrorClassIsDiscarded(string className) + { + if (DiscardClasses == null) { return false; } - foreach (var redactedKey in RedactedKeys) + foreach (var regex in DiscardClasses) { - if (key.ToLower() == redactedKey.ToLower()) + if (regex.IsMatch(className)) { return true; } @@ -188,19 +209,12 @@ public ulong AppHangThresholdMillis } } - public string[] DiscardClasses; - public int MaxPersistedEvents = 32; public int MaxPersistedSessions = 128; public int MaxStringValueLength = 10000; - internal bool ErrorClassIsDiscarded(string className) - { - return DiscardClasses != null && DiscardClasses.Contains(className); - } - private bool IsRunningInEditor() { return Application.platform == RuntimePlatform.OSXEditor @@ -208,55 +222,86 @@ private bool IsRunningInEditor() || Application.platform == RuntimePlatform.LinuxEditor; } + // Thread-safe collections with locks + private readonly object _onErrorLock = new object(); private List<Func<IEvent, bool>> _onErrorCallbacks = new List<Func<IEvent, bool>>(); + private readonly object _onSendErrorLock = new object(); + private List<Func<IEvent, bool>> _onSendErrorCallbacks = new List<Func<IEvent, bool>>(); + + private readonly object _onSessionLock = new object(); + private List<Func<ISession, bool>> _onSessionCallbacks = new List<Func<ISession, bool>>(); + public void AddOnError(Func<IEvent, bool> callback) { - _onErrorCallbacks.Add(callback); + lock (_onErrorLock) + { + _onErrorCallbacks.Add(callback); + } } internal List<Func<IEvent, bool>> GetOnErrorCallbacks() { - return _onErrorCallbacks; + lock (_onErrorLock) + { + return _onErrorCallbacks.ToList(); + } } public void RemoveOnError(Func<IEvent, bool> callback) { - _onErrorCallbacks.Remove(callback); + lock (_onErrorLock) + { + _onErrorCallbacks.Remove(callback); + } } - private List<Func<IEvent, bool>> _onSendErrorCallbacks = new List<Func<IEvent, bool>>(); - public void AddOnSendError(Func<IEvent, bool> callback) { - _onSendErrorCallbacks.Add(callback); + lock (_onSendErrorLock) + { + _onSendErrorCallbacks.Add(callback); + } } internal List<Func<IEvent, bool>> GetOnSendErrorCallbacks() { - return _onSendErrorCallbacks; + lock (_onSendErrorLock) + { + return _onSendErrorCallbacks.ToList(); + } } public void RemoveOnSendError(Func<IEvent, bool> callback) { - _onSendErrorCallbacks.Remove(callback); + lock (_onSendErrorLock) + { + _onSendErrorCallbacks.Remove(callback); + } } - private List<Func<ISession, bool>> _onSessionCallbacks = new List<Func<ISession, bool>>(); - public void AddOnSession(Func<ISession, bool> callback) { - _onSessionCallbacks.Add(callback); + lock (_onSessionLock) + { + _onSessionCallbacks.Add(callback); + } } public void RemoveOnSession(Func<ISession, bool> callback) { - _onSessionCallbacks.Remove(callback); + lock (_onSessionLock) + { + _onSessionCallbacks.Remove(callback); + } } internal List<Func<ISession, bool>> GetOnSessionCallbacks() { - return _onSessionCallbacks; + lock (_onSessionLock) + { + return _onSessionCallbacks.ToList(); + } } public List<TelemetryType> Telemetry = new List<TelemetryType> { TelemetryType.InternalErrors, TelemetryType.Usage }; diff --git a/src/BugsnagUnity/Delivery.cs b/src/BugsnagUnity/Delivery.cs index 2057f387f..55b8601fd 100644 --- a/src/BugsnagUnity/Delivery.cs +++ b/src/BugsnagUnity/Delivery.cs @@ -9,6 +9,7 @@ using BugsnagUnity.Payload; using UnityEngine; using UnityEngine.Networking; +using System.Security.Cryptography; namespace BugsnagUnity { @@ -187,6 +188,8 @@ IEnumerator PushToServer(IPayload payload) { req.SetRequestHeader("Content-Type", "application/json"); req.SetRequestHeader("Bugsnag-Sent-At", DateTimeOffset.Now.ToString("o", CultureInfo.InvariantCulture)); + req.SetRequestHeader("Bugsnag-Integrity", "sha1 " + Hash(body)); + foreach (var header in payload.Headers) { req.SetRequestHeader(header.Key, header.Value); @@ -278,6 +281,20 @@ private byte[] PrepareEventBodySimple(IPayload payload) return serialisedPayload; } + private string Hash(byte[] input) + { + using (SHA1Managed sha1 = new SHA1Managed()) + { + var hash = sha1.ComputeHash(input); + var sb = new StringBuilder(hash.Length * 2); + foreach (byte b in hash) + { + sb.Append(b.ToString("x2")); + } + return sb.ToString(); + } + } + private bool TruncateBreadcrumbs(Dictionary<string, object> @event, int bytesToRemove) { var breadcrumbsList = (@event[EVENT_KEY_BREADCRUMBS] as Dictionary<string, object>[]).ToList(); diff --git a/src/BugsnagUnity/Native/Android/NativeEvent.cs b/src/BugsnagUnity/Native/Android/NativeEvent.cs index 8885c2991..222270029 100644 --- a/src/BugsnagUnity/Native/Android/NativeEvent.cs +++ b/src/BugsnagUnity/Native/Android/NativeEvent.cs @@ -28,7 +28,7 @@ public NativeEvent(AndroidJavaObject androidJavaObject) : base (androidJavaObjec public List<IThread> Threads => GetThreads(); - public bool? Unhandled { get => NativePointer.Call<bool>("isUnhandled"); set => NativePointer.Call("setUnhandled", (bool)value); } + public bool Unhandled { get => NativePointer.Call<bool>("isUnhandled"); set => NativePointer.Call("setUnhandled", (bool)value); } private Severity GetSeverity() { diff --git a/src/BugsnagUnity/Native/Android/NativeInterface.cs b/src/BugsnagUnity/Native/Android/NativeInterface.cs index 3bcc9adac..007b08602 100644 --- a/src/BugsnagUnity/Native/Android/NativeInterface.cs +++ b/src/BugsnagUnity/Native/Android/NativeInterface.cs @@ -160,6 +160,7 @@ public NativeInterface(Configuration cfg) { _configuration = cfg; AndroidJavaObject config = CreateNativeConfig(cfg); + ConfigureNotifierInfo(config); Unity2019OrNewer = IsUnity2019OrNewer(); MainThread = Thread.CurrentThread; using (AndroidJavaClass system = new AndroidJavaClass("java.lang.System")) @@ -312,10 +313,9 @@ public NativeInterface(Configuration cfg) activityName = AndroidJNI.GetStringUTFChars(activityNameObject.GetRawObject()); } } - sessionTracker.Call("updateForegroundTracker", activityName, true, 0L); + sessionTracker.Call("updateContext", activityName, true); } - ConfigureNotifierInfo(client); } } @@ -346,7 +346,7 @@ AndroidJavaObject CreateNativeConfig(Configuration config) obj.Call("setSendLaunchCrashesSynchronously", config.SendLaunchCrashesSynchronously); obj.Call("setMaxReportedThreads", config.MaxReportedThreads); obj.Call("setMaxStringValueLength", config.MaxStringValueLength); - + obj.Call("setGenerateAnonymousId", config.GenerateAnonymousId); if (config.GetUser() != null) { @@ -454,9 +454,15 @@ AndroidJavaObject CreateNativeConfig(Configuration config) } // set DiscardedClasses - if (config.DiscardClasses != null && config.DiscardClasses.Length > 0) + if (config.DiscardClasses != null && config.DiscardClasses.Count > 0) { - obj.Call("setDiscardClasses", GetAndroidStringSetFromArray(config.DiscardClasses)); + var patternsAsStrings = new string[config.DiscardClasses.Count]; + foreach (var pattern in config.DiscardClasses) + { + patternsAsStrings[config.DiscardClasses.IndexOf(pattern)] = pattern.ToString(); + } + + obj.Call("setDiscardClasses", GetAndroidRegexPatternSetFromArray(patternsAsStrings)); } // set ProjectPackages @@ -466,9 +472,14 @@ AndroidJavaObject CreateNativeConfig(Configuration config) } // set redacted keys - if (config.RedactedKeys != null && config.RedactedKeys.Length > 0) + if (config.RedactedKeys != null && config.RedactedKeys.Count > 0) { - obj.Call("setRedactedKeys", GetAndroidStringSetFromArray(config.RedactedKeys)); + var patternsAsStrings = new string[config.RedactedKeys.Count]; + foreach (var key in config.RedactedKeys) + { + patternsAsStrings[config.RedactedKeys.IndexOf(key)] = key.ToString(); + } + obj.Call("setRedactedKeys", GetAndroidRegexPatternSetFromArray(patternsAsStrings)); } // add unity event callback @@ -508,11 +519,31 @@ private AndroidJavaObject GetAndroidStringSetFromArray(string[] array) return set; } - private void ConfigureNotifierInfo(AndroidJavaObject client) + private AndroidJavaObject GetAndroidRegexPatternSetFromArray(string[] array) { - using (AndroidJavaObject notifier = client.Get<AndroidJavaObject>("notifier")) + AndroidJavaObject set = new AndroidJavaObject("java.util.HashSet"); + AndroidJavaClass patternClass = new AndroidJavaClass("java.util.regex.Pattern"); + + foreach (var item in array) { + try + { + AndroidJavaObject pattern = patternClass.CallStatic<AndroidJavaObject>("compile", item); + set.Call<bool>("add", pattern); + } + catch (AndroidJavaException e) + { + Debug.LogWarning("Failed to compile regex pattern: " + item + " " + e.Message); + } + } + return set; + } + + private void ConfigureNotifierInfo(AndroidJavaObject config) + { + using (AndroidJavaObject notifier = config.Call<AndroidJavaObject>("getNotifier")) + { AndroidJavaObject androidNotifier = new AndroidJavaObject("com.bugsnag.android.Notifier"); androidNotifier.Call("setUrl", androidNotifier.Get<string>("url")); androidNotifier.Call("setName", androidNotifier.Get<string>("name")); diff --git a/src/BugsnagUnity/Native/Android/NativeThread.cs b/src/BugsnagUnity/Native/Android/NativeThread.cs index 743c23be8..4b79b01aa 100644 --- a/src/BugsnagUnity/Native/Android/NativeThread.cs +++ b/src/BugsnagUnity/Native/Android/NativeThread.cs @@ -9,7 +9,7 @@ internal class NativeThread : NativePayloadClassWrapper, IThread { public NativeThread(AndroidJavaObject androidJavaObject) : base(androidJavaObject){} - public string Id { get => GetNativeLong("getId").ToString(); set => SetNativeLong("setId",long.Parse(value)); } + public string Id { get => GetNativeString("getId"); set => SetNativeString("setId",value); } public bool? ErrorReportingThread => GetNativeBool("getErrorReportingThread"); diff --git a/src/BugsnagUnity/Native/Cocoa/NativeClient.cs b/src/BugsnagUnity/Native/Cocoa/NativeClient.cs index eb5e1b55a..7651db39c 100644 --- a/src/BugsnagUnity/Native/Cocoa/NativeClient.cs +++ b/src/BugsnagUnity/Native/Cocoa/NativeClient.cs @@ -73,13 +73,23 @@ IntPtr CreateNativeConfig(Configuration config) var user = config.GetUser(); NativeCode.bugsnag_setUserInConfig(obj, user.Id, user.Email, user.Name); } - if (config.DiscardClasses != null && config.DiscardClasses.Length > 0) + if (config.DiscardClasses != null && config.DiscardClasses.Count > 0) { - NativeCode.bugsnag_setDiscardClasses(obj, config.DiscardClasses, config.DiscardClasses.Length); + var patternsAsStrings = new string[config.DiscardClasses.Count]; + foreach (var key in config.DiscardClasses) + { + patternsAsStrings[config.DiscardClasses.IndexOf(key)] = key.ToString(); + } + NativeCode.bugsnag_setDiscardClasses(obj, patternsAsStrings, patternsAsStrings.Length); } - if (config.RedactedKeys != null && config.RedactedKeys.Length > 0) + if (config.RedactedKeys != null && config.RedactedKeys.Count > 0) { - NativeCode.bugsnag_setRedactedKeys(obj, config.RedactedKeys, config.RedactedKeys.Length); + var patternsAsStrings = new string[config.RedactedKeys.Count]; + foreach (var key in config.RedactedKeys) + { + patternsAsStrings[config.RedactedKeys.IndexOf(key)] = key.ToString(); + } + NativeCode.bugsnag_setRedactedKeys(obj, patternsAsStrings, patternsAsStrings.Length); } SetEnabledTelemetryTypes(obj,config); diff --git a/src/BugsnagUnity/Native/Cocoa/NativeEvent.cs b/src/BugsnagUnity/Native/Cocoa/NativeEvent.cs index 010141b9f..dc4c12f17 100644 --- a/src/BugsnagUnity/Native/Cocoa/NativeEvent.cs +++ b/src/BugsnagUnity/Native/Cocoa/NativeEvent.cs @@ -28,7 +28,13 @@ public class NativeEvent : NativePayloadClassWrapper, IEvent public string GroupingHash { get => GetNativeString(GROUPING_HASH_KEY); set => SetNativeString(GROUPING_HASH_KEY, value); } - public bool? Unhandled { get => GetNativeBool(UNHANDLED_KEY); set => SetNativeBool(UNHANDLED_KEY, value); } + public bool Unhandled { + get { + var nativeBool = GetNativeBool(UNHANDLED_KEY); + return nativeBool.HasValue ? nativeBool.Value : false; + } + set => SetNativeBool(UNHANDLED_KEY, value); + } private List<IBreadcrumb> _breadcrumbs = new List<IBreadcrumb>(); diff --git a/src/BugsnagUnity/Payload/Event.cs b/src/BugsnagUnity/Payload/Event.cs index bfde88c2b..e1e845123 100644 --- a/src/BugsnagUnity/Payload/Event.cs +++ b/src/BugsnagUnity/Payload/Event.cs @@ -61,6 +61,11 @@ internal Event(Dictionary<string, object> serialisedPayload) { Add("unhandled", eventObject["unhandled"]); } + else + { + Add("unhandled", false); + } + if (eventObject["severity"] != null) { Add("severity", eventObject["severity"]); @@ -190,7 +195,17 @@ internal void AddAndroidProjectPackagesToEvent(string[] packages) internal LogType? LogType { get; } - public bool? Unhandled { get => (bool)Get("unhandled"); set => Add("unhandled",value); } + public bool Unhandled { + get { + var currentValue = Get("unhandled"); + if (currentValue == null) + { + return false; + } + return (bool)currentValue; + } + set => Add("unhandled",value); + } internal bool IsHandled { diff --git a/src/BugsnagUnity/Payload/IEvent.cs b/src/BugsnagUnity/Payload/IEvent.cs index 86bd9c668..95b9c33e6 100644 --- a/src/BugsnagUnity/Payload/IEvent.cs +++ b/src/BugsnagUnity/Payload/IEvent.cs @@ -27,6 +27,6 @@ public interface IEvent: IMetadataEditor, IUserEditor, IFeatureFlagStore List<IThread> Threads { get; } - bool? Unhandled { get; set; } + bool Unhandled { get; set; } } } diff --git a/tests/BugsnagUnity.Tests/ConfigurationTests.cs b/tests/BugsnagUnity.Tests/ConfigurationTests.cs index 3551fa9be..0f3db1971 100644 --- a/tests/BugsnagUnity.Tests/ConfigurationTests.cs +++ b/tests/BugsnagUnity.Tests/ConfigurationTests.cs @@ -1,5 +1,8 @@ using NUnit.Framework; +using System; +using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using System.Threading; using UnityEngine; @@ -82,5 +85,125 @@ public void EndpointValidation() Assert.IsFalse(config.Endpoints.IsValid); } + + [Test] + public void RedactedKeysTest() + { + var config = new Configuration("foo"); + + // Default redacted keys + Assert.IsTrue(config.KeyIsRedacted("user-password")); + Assert.IsFalse(config.KeyIsRedacted("username")); + + var config2 = new Configuration("foo"); + + // Custom redacted keys + config2.RedactedKeys.Add(new Regex(".*secret.*", RegexOptions.IgnoreCase)); + config2.RedactedKeys.Add(new Regex(".*token.*", RegexOptions.IgnoreCase)); + Assert.IsTrue(config2.KeyIsRedacted("secret")); + Assert.IsTrue(config2.KeyIsRedacted("token")); + Assert.IsTrue(config2.KeyIsRedacted("password")); + Assert.IsFalse(config2.KeyIsRedacted("app_id")); + } + + [Test] + public void DiscardedClassesTest() + { + var config = new Configuration("foo"); + + // No discard classes by default + Assert.IsFalse(config.ErrorClassIsDiscarded("System.Exception")); + + var config2 = new Configuration("foo"); + + // Adding discard classes + config2.DiscardClasses.Add(new Regex("^System\\.Exception$", RegexOptions.IgnoreCase)); + config2.DiscardClasses.Add(new Regex("^System\\.NullReferenceException$", RegexOptions.IgnoreCase)); + Assert.IsTrue(config2.ErrorClassIsDiscarded("System.Exception")); + Assert.IsTrue(config2.ErrorClassIsDiscarded("System.NullReferenceException")); + Assert.IsFalse(config2.ErrorClassIsDiscarded("System.ArgumentException")); + } + + [Test] + public void ThreadSafeCallbacksTest() + { + var config = new Configuration("foo"); + + // Define a simple callback function + Func<IEvent, bool> callback1 = (e) => true; + Func<IEvent, bool> callback2 = (e) => false; + Func<ISession, bool> sessionCallback = (s) => true; + + // We will use these lists to store the results from multiple threads + List<bool> onErrorResults = new List<bool>(); + List<bool> onSendErrorResults = new List<bool>(); + List<bool> onSessionResults = new List<bool>(); + + // Adding callbacks in multiple threads + Thread addThread1 = new Thread(() => + { + for (int i = 0; i < 50; i++) + { + config.AddOnError(callback1); + config.AddOnSendError(callback2); + config.AddOnSession(sessionCallback); + } + }); + + Thread addThread2 = new Thread(() => + { + for (int i = 0; i < 50; i++) + { + config.AddOnError(callback2); + config.AddOnSendError(callback1); + config.AddOnSession(sessionCallback); + } + }); + + // Removing callbacks in multiple threads + Thread removeThread1 = new Thread(() => + { + for (int i = 0; i < 25; i++) + { + config.RemoveOnError(callback1); + config.RemoveOnSendError(callback2); + config.RemoveOnSession(sessionCallback); + } + }); + + Thread removeThread2 = new Thread(() => + { + for (int i = 0; i < 25; i++) + { + config.RemoveOnError(callback2); + config.RemoveOnSendError(callback1); + config.RemoveOnSession(sessionCallback); + } + }); + + // Start all threads + addThread1.Start(); + addThread2.Start(); + removeThread1.Start(); + removeThread2.Start(); + + // Wait for all threads to complete + addThread1.Join(); + addThread2.Join(); + removeThread1.Join(); + removeThread2.Join(); + + // Verify the state of the callback lists + // The exact number might vary depending on the execution order, + // but there should be no exceptions thrown and the list should not be empty + Assert.IsTrue(config.GetOnErrorCallbacks().Count > 0, "OnErrorCallbacks should have entries."); + Assert.IsTrue(config.GetOnSendErrorCallbacks().Count > 0, "OnSendErrorCallbacks should have entries."); + Assert.IsTrue(config.GetOnSessionCallbacks().Count > 0, "OnSessionCallbacks should have entries."); + + // Check if the remaining callbacks are as expected + Assert.IsTrue(config.GetOnErrorCallbacks().Contains(callback1) || config.GetOnErrorCallbacks().Contains(callback2), "Callback1 or Callback2 should be in OnErrorCallbacks."); + Assert.IsTrue(config.GetOnSendErrorCallbacks().Contains(callback1) || config.GetOnSendErrorCallbacks().Contains(callback2), "Callback1 or Callback2 should be in OnSendErrorCallbacks."); + Assert.IsTrue(config.GetOnSessionCallbacks().Contains(sessionCallback), "SessionCallback should be in OnSessionCallbacks."); + } } }