From 30aa4a911a6b756adfa3138c393a3d00eb6d053a Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Mon, 11 Apr 2022 09:13:19 +0100 Subject: [PATCH 01/25] Stop using -[BugsnagSession toDictionary] (#547) --- src/BugsnagUnity.m | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/BugsnagUnity.m b/src/BugsnagUnity.m index 32981a391..e764702dc 100644 --- a/src/BugsnagUnity.m +++ b/src/BugsnagUnity.m @@ -360,18 +360,10 @@ void bugsnag_registerSession(char *sessionId, long startedAt, int unhandledCount unhandledCount:(NSUInteger)unhandledCount]; } -void bugsnag_retrieveCurrentSession(const void *session, void (*callback)(const void *instance, const char *sessionId, const char *startedAt, int handled, int unhandled)) { - if([Bugsnag client].sessionTracker.runningSession == NULL) - { - callback(session, NULL, NULL, 0, 0); - return; - } - NSDictionary * sessionDict = [[Bugsnag client].sessionTracker.runningSession toDictionary]; - const char *sessionId = [[sessionDict objectForKey:@"id"] UTF8String]; - const char *timeString = [[sessionDict objectForKey:@"startedAt"] UTF8String]; - int handled = [sessionDict[@"handledCount"] integerValue]; - int unhandled = [sessionDict[@"unhandledCount"] integerValue]; - callback(session, sessionId, timeString, handled, unhandled); +void bugsnag_retrieveCurrentSession(const void *ptr, void (*callback)(const void *instance, const char *sessionId, const char *startedAt, int handled, int unhandled)) { + BugsnagSession *session = Bugsnag.client.sessionTracker.runningSession; + NSString *startedAt = session.startedAt ? [BSG_RFC3339DateTool stringFromDate:session.startedAt] : nil; + callback(ptr, session.id.UTF8String, startedAt.UTF8String, (int)session.handledCount, (int)session.unhandledCount); } void bugsnag_markLaunchCompleted() { From 9e29791b6e9a81cb15e44bd27c5e07d9f738f9f7 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Wed, 27 Apr 2022 15:15:37 +0200 Subject: [PATCH 02/25] fix(ci): fix flake in mobile persistence tests [full ci] --- features/android/android_persistence.feature | 2 +- .../Assets/Scripts/MobileScenarioRunner.cs | 34 ++++++++++++++++++- features/ios/ios_persistence.feature | 2 +- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/features/android/android_persistence.feature b/features/android/android_persistence.feature index 9228171ff..dc3b88662 100644 --- a/features/android/android_persistence.feature +++ b/features/android/android_persistence.feature @@ -5,7 +5,7 @@ Feature: Android event persistence tests Scenario: Get Persisted event When I run the "Persist" mobile scenario - And I wait for 4 seconds + Then I wait to receive a session When I clear any error dialogue And I relaunch the Unity mobile app When I run the "throw Exception" mobile scenario diff --git a/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs b/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs index fe5c5bfc2..7dac8c351 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs @@ -147,7 +147,8 @@ private Configuration PreapareConfigForScenario(string scenarioName) case "Persist": config.EnabledErrorTypes.OOMs = false; config.AutoDetectErrors = true; - config.Endpoints = new EndpointConfiguration("https://notify.def-not-bugsnag.com", "https://notify.def-not-bugsnag.com"); + config.AutoTrackSessions = false; + config.Endpoints = new EndpointConfiguration("https://notify.def-not-bugsnag.com", "http://bs-local.com:9339/sessions"); break; case "Persist Report": config.EnabledErrorTypes.OOMs = false; @@ -512,7 +513,10 @@ public void DoTestAction(string scenarioName) MobileNative.TriggerBackgroundJavaCrash(); break; case "throw Exception": + ThrowException(); + break; case "Persist Report": + AddDebugMetadata(); ThrowException(); break; case "throw Exception with breadcrumbs": @@ -564,6 +568,7 @@ public void DoTestAction(string scenarioName) ThrowException(); break; case "Persist": + StartCoroutine(CheckEventIsPersisted()); throw new Exception("Persisted Exception"); case "Clear iOS Data": MobileNative.ClearIOSData(); @@ -573,6 +578,33 @@ public void DoTestAction(string scenarioName) } } + private IEnumerator CheckEventIsPersisted() + { + if (!Directory.Exists(Application.persistentDataPath + "/Bugsnag/Events")) + { + yield return new WaitForSeconds(1); + } + if (Directory.GetFiles(Application.persistentDataPath + "/Bugsnag/Events", "*.event").Length == 0) + { + yield return new WaitForSeconds(1); + } + Bugsnag.StartSession(); + } + + private void AddDebugMetadata() + { + var metadata = new Dictionary(); + if (Directory.Exists(Application.persistentDataPath + "/Bugsnag/Events")) + { + metadata.Add("Events directory exsitsts with file count", Directory.GetFiles(Application.persistentDataPath + "/Bugsnag/Events", "*.event").Length); + } + else + { + metadata.Add("Events Dir Does Not Exist!","wtf"); + } + Bugsnag.AddMetadata("debug", metadata); + } + private void CheckLastRunInfo() { var info = Bugsnag.GetLastRunInfo(); diff --git a/features/ios/ios_persistence.feature b/features/ios/ios_persistence.feature index 59de0642f..d8196ab24 100644 --- a/features/ios/ios_persistence.feature +++ b/features/ios/ios_persistence.feature @@ -6,7 +6,7 @@ Feature: iOS event persistence tests Scenario: Get Persisted event When I run the "Persist" mobile scenario - And I wait for 4 seconds + Then I wait to receive a session And I close and relaunch the Unity mobile app When I run the "Persist Report" mobile scenario Then I wait to receive 2 errors From b7029ac29ea186368c399faed2100db2b5b7cbc1 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Fri, 29 Apr 2022 23:40:58 +0200 Subject: [PATCH 03/25] typo fix [full ci] --- .../maze_runner/Assets/Scripts/MobileScenarioRunner.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs b/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs index 7dac8c351..64507cdbe 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/MobileScenarioRunner.cs @@ -580,11 +580,11 @@ public void DoTestAction(string scenarioName) private IEnumerator CheckEventIsPersisted() { - if (!Directory.Exists(Application.persistentDataPath + "/Bugsnag/Events")) + while (!Directory.Exists(Application.persistentDataPath + "/Bugsnag/Events")) { yield return new WaitForSeconds(1); } - if (Directory.GetFiles(Application.persistentDataPath + "/Bugsnag/Events", "*.event").Length == 0) + while (Directory.GetFiles(Application.persistentDataPath + "/Bugsnag/Events", "*.event").Length == 0) { yield return new WaitForSeconds(1); } From b5d5b1938b0ab26fe76c52f6321f63bb46b3b6d4 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 3 May 2022 07:59:22 +0100 Subject: [PATCH 04/25] Exit build script immediately on error --- features/scripts/build_maze_runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/scripts/build_maze_runner.sh b/features/scripts/build_maze_runner.sh index 3cef5496d..b1d5485cf 100755 --- a/features/scripts/build_maze_runner.sh +++ b/features/scripts/build_maze_runner.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -e if [ -z "$UNITY_VERSION" ]; then echo "UNITY_VERSION must be set, to e.g. 2018.4.36f1" From 382b7ecce9b6561b4b094af90900d290a03c8d18 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 12 May 2022 10:19:01 +0100 Subject: [PATCH 05/25] dep: bump bugsnag-android to v5.22.3 --- CHANGELOG.md | 18 ++++++++++++++++++ bugsnag-android | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49943acae..d415ad5e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## TBD + +### Enhancements + +* Update bugsnag-android to v5.22.3 + * Max reported threads can now be configured using manifest meta-data "com.bugsnag.android. MAX_REPORTED_THREADS" + [bugsnag-android#1655](https://github.com/bugsnag/bugsnag-android/pull/1655) + * Small improvement to startup performance (Bugsnag.start) + [bugsnag-android#1648](https://github.com/bugsnag/bugsnag-android/pull/1648) + * Fixed NDK stack-traces for libraries linked after `Bugsnag.start` was called + [bugsnag-android#1671](https://github.com/bugsnag/bugsnag-android/pull/1671) + * Fixed concurrency bug that could be triggered via the React Native plugin + [bugsnag-android#1679](https://github.com/bugsnag/bugsnag-android/pull/1679) + * Correctly report `device.locationStatus` on Android 12 onwards using `LocationManager.isLocationEnabled` + [bugsnag-android#1683](https://github.com/bugsnag/bugsnag-android/pull/1683) + * Small performance improvements to `Bugnag.start` + [bugsnag-android#1680](https://github.com/bugsnag/bugsnag-android/pull/1680) + ## 6.3.1 (2022-04-06) ### Enhancements diff --git a/bugsnag-android b/bugsnag-android index a5824a31e..55c2fe1c4 160000 --- a/bugsnag-android +++ b/bugsnag-android @@ -1 +1 @@ -Subproject commit a5824a31e1156cd603475e571b3ba458ffb90a51 +Subproject commit 55c2fe1c4a693472fcf64220acdb8d225fd36273 From 72dc79f52a585dcbd1e0adcdbf260f478a2c014b Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Tue, 17 May 2022 18:14:22 +0100 Subject: [PATCH 06/25] Increase BrowserStack slots to 24 --- .buildkite/pipeline.full.yml | 14 +++++++------- .buildkite/pipeline.yml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 0d34afc9a..8f4114ea0 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -285,7 +285,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/android" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -308,7 +308,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/android" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -333,7 +333,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/android" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -358,7 +358,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/edm" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -523,7 +523,7 @@ steps: - "--device=IOS_14" - "--fail-fast" - "features/ios" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -547,7 +547,7 @@ steps: - "--device=IOS_14" - "--fail-fast" - "features/ios" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -571,7 +571,7 @@ steps: - "--device=IOS_14" - "--fail-fast" - "features/ios" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 6f949de0b..25965c971 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -156,7 +156,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/android" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -181,7 +181,7 @@ steps: - "--farm=bs" - "--device=ANDROID_9_0" - "features/edm" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager @@ -254,7 +254,7 @@ steps: - "--device=IOS_14" - "--fail-fast" - "features/ios" - concurrency: 9 + concurrency: 24 concurrency_group: browserstack-app concurrency_method: eager From c92189bd02410fce0c78bcdda7e0f96d66e01429 Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Fri, 20 May 2022 11:23:34 +0200 Subject: [PATCH 07/25] Re Merge new exception handler after pipeline changes (#541) --- .buildkite/pipeline.full.yml | 2 + .../android/android_csharp_errors.feature | 1 - features/android/android_log_errors.feature | 1 - features/desktop/handled_errors.feature | 12 +-- features/desktop/unhandled_errors.feature | 37 ++++---- .../maze_runner/Assets/Scripts/Main.cs | 8 ++ features/ios/ios_csharp_errors.feature | 1 - features/ios/ios_log.feature | 11 ++- features/support/env.rb | 9 ++ src/BugsnagUnity/Client.cs | 84 ++++++++++++++++++- src/BugsnagUnity/Payload/Error.cs | 81 ++++++++++++------ src/BugsnagUnity/Payload/HandledState.cs | 9 ++ src/BugsnagUnity/Payload/StackTraceLine.cs | 4 + src/BugsnagUnity/UnityLogMessage.cs | 10 +++ 14 files changed, 214 insertions(+), 56 deletions(-) diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 8f4114ea0..9abe8c5dd 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -642,6 +642,7 @@ steps: queue: opensource-windows-unity env: UNITY_VERSION: "2018.4.36f1" + WSLENV: "UNITY_VERSION" command: - scripts/ci-run-windows-tests.bat artifact_paths: @@ -654,6 +655,7 @@ steps: queue: opensource-windows-unity env: UNITY_VERSION: "2019.4.35f1" + WSLENV: "UNITY_VERSION" command: - scripts/ci-run-windows-tests.bat artifact_paths: diff --git a/features/android/android_csharp_errors.feature b/features/android/android_csharp_errors.feature index 94bc6b5cd..b261e6bb1 100644 --- a/features/android/android_csharp_errors.feature +++ b/features/android/android_csharp_errors.feature @@ -98,7 +98,6 @@ Feature: Android smoke tests for C# errors # Stacktrace validation And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array And the event "exceptions.0.stacktrace.0.method" equals "MobileScenarioRunner.ThrowException()" - And the event "exceptions.0.stacktrace.0.file" is not null And the event "exceptions.0.stacktrace.0.lineNumber" equals 0 And the error payload field "events.0.threads" is null diff --git a/features/android/android_log_errors.feature b/features/android/android_log_errors.feature index fe67a3e7c..b3bf22f2b 100644 --- a/features/android/android_log_errors.feature +++ b/features/android/android_log_errors.feature @@ -18,7 +18,6 @@ Feature: Android smoke tests for C# errors # Stacktrace validation And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array And the event "exceptions.0.stacktrace.0.method" equals "MobileScenarioRunner.LogCaughtException()" - And the event "exceptions.0.stacktrace.0.file" is not null And the event "exceptions.0.stacktrace.0.lineNumber" equals 0 And the error payload field "events.0.threads" is null diff --git a/features/desktop/handled_errors.feature b/features/desktop/handled_errors.feature index a03039f56..d7b3fbffc 100644 --- a/features/desktop/handled_errors.feature +++ b/features/desktop/handled_errors.feature @@ -108,9 +108,9 @@ Feature: Handled Errors and Exceptions And the event "unhandled" is false And custom metadata is included in the event And the stack frame methods should match: - | Main:DoLogUnthrown() | - | Main:RunScenario(String) | - | Main:Start() | + | Main:DoLogUnthrown() | Main.DoLogUnthrown() | + | Main:RunScenario(String) | Main.RunScenario(string scenario) | + | Main:Start() | Main.Start() | Scenario: Logging an unthrown exception as unhandled When I run the game in the "LogUnthrownAsUnhandled" state @@ -121,9 +121,9 @@ Feature: Handled Errors and Exceptions And the event "unhandled" is true And custom metadata is included in the event And the stack frame methods should match: - | Main:DebugLogException() | - | Main:RunScenario(String) | - | Main:Start() | + | Main:DebugLogException() | Main.DebugLogException() | + | Main:RunScenario(String) | Main.RunScenario(string scenario) | + | Main:Start() | Main.Start() | @skip_webgl Scenario: Logging a warning from a background thread to Bugsnag diff --git a/features/desktop/unhandled_errors.feature b/features/desktop/unhandled_errors.feature index d18bf17dc..4960b721a 100644 --- a/features/desktop/unhandled_errors.feature +++ b/features/desktop/unhandled_errors.feature @@ -1,5 +1,14 @@ Feature: Reporting unhandled events + @skip_unity_2018 + Scenario: Reporting an inner exception + When I run the game in the "InnerException" state + And I wait to receive an error + Then the error is valid for the error reporting API sent by the Unity notifier + And the event "exceptions.0.message" equals "Outer" + And the event "exceptions.1.message" equals "Inner" + And the event "exceptions.2" is null + Scenario: Reporting an uncaught exception When I run the game in the "UncaughtException" state And I wait to receive an error @@ -9,9 +18,9 @@ Feature: Reporting unhandled events And the event "unhandled" is false And custom metadata is included in the event And the stack frame methods should match: - | Main.DoUnhandledException(Int64 counter) | Main.DoUnhandledException(System.Int64 counter) | - | Main.RunScenario(System.String scenario) | | - | Main.Start() | | + | Main.DoUnhandledException(Int64 counter) | Main.DoUnhandledException(System.Int64 counter) | Main.DoUnhandledException(long counter) | + | Main.RunScenario(System.String scenario) | Main.RunScenario(string scenario) | | + | Main.Start() | | | @windows_only Scenario: Windows device and app data @@ -23,9 +32,9 @@ Feature: Reporting unhandled events And the event "unhandled" is false And custom metadata is included in the event And the stack frame methods should match: - | Main.DoUnhandledException(Int64 counter) | Main.DoUnhandledException(System.Int64 counter) | - | Main.RunScenario(System.String scenario) | | - | Main.Start() | | + | Main.DoUnhandledException(Int64 counter) | Main.DoUnhandledException(System.Int64 counter) | Main.DoUnhandledException(long counter) | + | Main.RunScenario(System.String scenario) | Main.RunScenario(string scenario) || + | Main.Start() ||| #device metadata @@ -76,8 +85,8 @@ Feature: Reporting unhandled events And the event "unhandled" is true And custom metadata is included in the event And the stack frame methods should match: - | Main.RunScenario(System.String scenario) | - | Main.Start() | + | Main.RunScenario(System.String scenario) | Main.RunScenario(string scenario) | + | Main.Start() || @webgl_only Scenario: Forcing uncaught exceptions to be unhandled @@ -89,9 +98,9 @@ Feature: Reporting unhandled events And the event "unhandled" is true And custom metadata is included in the event And the stack frame methods should match: - | Main.ThrowException() | - | Main.RunScenario(System.String scenario) | - | Main.Start() | + | Main.ThrowException() || + | Main.RunScenario(System.String scenario) | Main.RunScenario(string scenario) | + | Main.Start() || Scenario: Reporting an assertion failure When I run the game in the "AssertionFailure" state @@ -104,9 +113,9 @@ Feature: Reporting unhandled events And the event "unhandled" is false And custom metadata is included in the event And the stack frame methods should match: - | Main.MakeAssertionFailure(Int32 counter) | Main.MakeAssertionFailure(System.Int32 counter) | - | Main.RunScenario(System.String scenario) | | - | Main.Start() | | + | Main.MakeAssertionFailure(Int32 counter) | Main.MakeAssertionFailure(System.Int32 counter) | Main.MakeAssertionFailure(int counter) | + | Main.RunScenario(System.String scenario) | Main.RunScenario(string scenario) || + | Main.Start() | || @macos_only Scenario: Reporting a native crash diff --git a/features/fixtures/maze_runner/Assets/Scripts/Main.cs b/features/fixtures/maze_runner/Assets/Scripts/Main.cs index 840e709b3..9fac86f93 100644 --- a/features/fixtures/maze_runner/Assets/Scripts/Main.cs +++ b/features/fixtures/maze_runner/Assets/Scripts/Main.cs @@ -664,6 +664,9 @@ void RunScenario(string scenario) case "ClearBugsnagCache": ClearBugsnagCache(); break; + case "InnerException": + DoInnerException(); + break; case "NullBreadcrumbMessage": Bugsnag.LeaveBreadcrumb(null); Bugsnag.LeaveBreadcrumb("Not Null"); @@ -677,6 +680,11 @@ void RunScenario(string scenario) } } + private void DoInnerException() + { + throw new Exception("Outer",new Exception("Inner")); + } + private IEnumerator NotifyPersistedEvents() { for (int i = 0; i < 5; i++) diff --git a/features/ios/ios_csharp_errors.feature b/features/ios/ios_csharp_errors.feature index bb586d7a1..610625001 100644 --- a/features/ios/ios_csharp_errors.feature +++ b/features/ios/ios_csharp_errors.feature @@ -20,7 +20,6 @@ Feature: iOS smoke tests for C# errors # Stacktrace validation And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array And the event "exceptions.0.stacktrace.0.method" equals "MobileScenarioRunner.ThrowException()" - And the event "exceptions.0.stacktrace.0.file" is not null And the event "exceptions.0.stacktrace.0.lineNumber" equals 0 And the error payload field "events.0.threads" is null diff --git a/features/ios/ios_log.feature b/features/ios/ios_log.feature index 1123a74e5..e6515f4a0 100644 --- a/features/ios/ios_log.feature +++ b/features/ios/ios_log.feature @@ -18,9 +18,8 @@ Feature: iOS smoke tests for log entries And the event "severityReason.type" equals "handledException" # Stacktrace validation - And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array - And the event "exceptions.0.stacktrace.0.method" ends with "UnityEngine.Debug:LogError(Object)" - And the error payload field "events.0.threads" is null + And the stack frame methods should match: + | UnityEngine.Debug:LogError(Object) | # App data And the event "app.id" equals "com.bugsnag.unity.mazerunner" @@ -67,10 +66,10 @@ Feature: iOS smoke tests for log entries And the event "severityReason.type" equals "handledException" # Stacktrace validation - And the error payload field "events.0.exceptions.0.stacktrace" is a non-empty array - And the event "exceptions.0.stacktrace.0.method" ends with "MobileScenarioRunner.LogCaughtException()" And the error payload field "events.0.threads" is null - + And the stack frame methods should match: + | MobileScenarioRunner.LogCaughtException() | + # App data And the event "app.id" equals "com.bugsnag.unity.mazerunner" And the event "app.releaseStage" equals "production" diff --git a/features/support/env.rb b/features/support/env.rb index dc6dc9b18..a201ed917 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,5 +1,14 @@ require 'fileutils' +Before('@skip_unity_2018') do |_scenario| + if ENV['UNITY_VERSION'] + unity_version = ENV['UNITY_VERSION'][0..3].to_i + if unity_version == 2018 + skip_this_scenario('Skipping scenario on Unity 2018') + end + end +end + Before('@skip_webgl') do |_scenario| skip_this_scenario("Skipping scenario") unless Maze.config.browser.nil? end diff --git a/src/BugsnagUnity/Client.cs b/src/BugsnagUnity/Client.cs index 1374055d9..8c7d84c51 100644 --- a/src/BugsnagUnity/Client.cs +++ b/src/BugsnagUnity/Client.cs @@ -48,6 +48,57 @@ internal class Client : IClient private List _featureFlags; + private bool _isUnity2019OrHigher; + + private class BugsnagLogHandler : ILogHandler + { + + private ILogHandler _oldLogHandler; + + private Client _client; + + private Configuration _config => _client.Configuration; + + public BugsnagLogHandler(ILogHandler oldLogHandler, Client client) + { + _oldLogHandler = oldLogHandler; + _client = client; + } + + public void LogException(System.Exception exception, UnityEngine.Object context) + { + if (_config.AutoDetectErrors && LogType.Exception.IsGreaterThanOrEqualTo(_config.NotifyLogLevel)) + { + var unityLogMessage = new UnityLogMessage(exception); + var shouldSend = Error.ShouldSend(exception) + && _client._uniqueCounter.ShouldSend(unityLogMessage) + && _client._logTypeCounter.ShouldSend(unityLogMessage); + if (shouldSend) + { + var handledState = _config.ReportExceptionLogsAsHandled ? HandledState.ForLoggedException() : HandledState.ForUnhandledException(); + _client.Notify(exception, handledState, null, 3); + } + } + if (_oldLogHandler != null) + { + _oldLogHandler.LogException(exception, context); + } + } + + public void LogFormat(LogType logType, UnityEngine.Object context, string format, params object[] args) + { + if (_oldLogHandler != null) + { + _oldLogHandler.LogFormat(logType, context, format, args); + } + } + } + + private void SetupAdvancedExceptionInterceptor() + { + var oldHandler = UnityEngine.Debug.unityLogger.logHandler; + UnityEngine.Debug.unityLogger.logHandler = new BugsnagLogHandler(oldHandler, this); + } public Client(INativeClient nativeClient) { @@ -56,13 +107,18 @@ public Client(INativeClient nativeClient) FileManager.InitFileManager(nativeClient.Configuration); MainThread = Thread.CurrentThread; SessionTracking = new SessionTracker(this); + _isUnity2019OrHigher = IsUnity2019OrHigher(); InitStopwatches(); InitUserObject(); InitMetadata(); InitFeatureFlags(); InitCounters(); ListenForSceneLoad(); - InitLogHandlers(); + InitLogHandlers(); + if (_isUnity2019OrHigher) + { + SetupAdvancedExceptionInterceptor(); + } InitTimingTracker(); InitInitialSessionCheck(); CheckForMisconfiguredEndpointsWarning(); @@ -70,6 +126,18 @@ public Client(INativeClient nativeClient) _delivery.StartDeliveringCachedPayloads(); } + private bool IsUnity2019OrHigher() + { + var version = Application.unityVersion; + //will be null in unit tests + if (version == null) + { + return false; + } + return !version.Contains("2017") && + !version.Contains("2018"); + } + private void InitFeatureFlags() { if (Configuration.FeatureFlags != null) @@ -229,6 +297,10 @@ void Notify(string condition, string stackTrace, LogType logType) { return; } + if (logType.Equals(LogType.Exception) && _isUnity2019OrHigher) + { + return; + } if (Configuration.AutoDetectErrors && logType.IsGreaterThanOrEqualTo(Configuration.NotifyLogLevel)) { var logMessage = new UnityLogMessage(condition, stackTrace, logType); @@ -312,7 +384,15 @@ void Notify(System.Exception exception, HandledState handledState, Func callback, LogType? logType) diff --git a/src/BugsnagUnity/Payload/Error.cs b/src/BugsnagUnity/Payload/Error.cs index 9642f2ec0..769f6311a 100644 --- a/src/BugsnagUnity/Payload/Error.cs +++ b/src/BugsnagUnity/Payload/Error.cs @@ -138,18 +138,29 @@ internal static Error FromSystemException(System.Exception exception, System.Dia var errorClass = exception.GetType().Name; var stackFrames = new System.Diagnostics.StackTrace(exception, true).GetFrames(); - StackTraceLine[] lines = null; - - if (stackFrames != null && stackFrames.Length > 0) + // JVM exceptions in the main thread are handled by unity and require extra formatting + if (errorClass == ANDROID_JAVA_EXCEPTION_CLASS) { - lines = new StackTrace(stackFrames).ToArray(); + var androidErrorData = ProcessAndroidError(exception.Message); + var androidErrorClass = androidErrorData[0]; + var androidErrorMessage = androidErrorData[1]; + var lines = new StackTrace(exception.StackTrace, StackTraceFormat.AndroidJava).ToArray(); + return new Error(androidErrorClass, androidErrorMessage, lines, HandledState.ForUnhandledException(), true); } else { - lines = new StackTrace(alternativeStackTrace).ToArray(); + StackTraceLine[] lines; + if (stackFrames != null && stackFrames.Length > 0) + { + lines = new StackTrace(stackFrames).ToArray(); + } + else + { + lines = new StackTrace(alternativeStackTrace).ToArray(); + } + return new Error(errorClass, exception.Message, lines); } - return new Error(errorClass, exception.Message, lines); } internal static Error FromStringInfo(string name, string message, string stacktrace) @@ -171,6 +182,29 @@ public static Error FromUnityLogMessage(UnityLogMessage logMessage, System.Diagn return FromUnityLogMessage(logMessage, stackFrames, severity, false); } + private static string[] ProcessAndroidError(string originalMessage) + { + string message; + string errorClass; + var match = Regex.Match(originalMessage, ERROR_CLASS_MESSAGE_PATTERN, RegexOptions.Singleline); + // If the message matches the "class: message" pattern, then the Java class is followed + // by a description of the Java exception. These two values will be used as the error + // class and message. + if (match.Success) + { + errorClass = match.Groups["errorClass"].Value; + message = match.Groups["message"].Value.Trim(); + } + else + { + // There was no Java exception description, so the Java class is the only content in + // the message. + errorClass = originalMessage; + message = string.Empty; + } + return new[] { errorClass, message }; + } + public static Error FromUnityLogMessage(UnityLogMessage logMessage, System.Diagnostics.StackFrame[] fallbackStackFrames, Severity severity, bool forceUnhandled) { var match = Regex.Match(logMessage.Condition, ERROR_CLASS_MESSAGE_PATTERN, RegexOptions.Singleline); @@ -190,28 +224,13 @@ public static Error FromUnityLogMessage(UnityLogMessage logMessage, System.Diagn var errorClass = match.Groups["errorClass"].Value; var message = match.Groups["message"].Value.Trim(); var isAndroidJavaException = false; - // Exceptions starting with "AndroidJavaException" are uncaught Java exceptions reported - // via the Unity log handler + // JVM exceptions in the main thread are handled by unity and require extra formatting if (errorClass == ANDROID_JAVA_EXCEPTION_CLASS) { isAndroidJavaException = true; - match = Regex.Match(message, ERROR_CLASS_MESSAGE_PATTERN, RegexOptions.Singleline); - - // If the message matches the "class: message" pattern, then the Java class is followed - // by a description of the Java exception. These two values will be used as the error - // class and message. - if (match.Success) - { - errorClass = match.Groups["errorClass"].Value; - message = match.Groups["message"].Value.Trim(); - } - else - { - // There was no Java exception description, so the Java class is the only content in - // the message. - errorClass = message; - message = ""; - } + var androidErrorData = ProcessAndroidError(message); + errorClass = androidErrorData[0]; + message = androidErrorData[1]; lines = new StackTrace(logMessage.StackTrace, StackTraceFormat.AndroidJava).ToArray(); handledState = HandledState.ForUnhandledException(); } @@ -224,6 +243,18 @@ public static Error FromUnityLogMessage(UnityLogMessage logMessage, System.Diagn } } + public static bool ShouldSend(System.Exception exception) + { + var errorClass = exception.GetType().Name; + if (errorClass != ANDROID_JAVA_EXCEPTION_CLASS && errorClass != NATIVE_ANDROID_ERROR_CLASS) + { + return true; + } + + var match = Regex.Match(exception.StackTrace, NATIVE_ANDROID_MESSAGE_PATTERN, RegexOptions.Singleline); + return !match.Success; + } + /// /// Validates the logMessage excluding previously delivered reports /// diff --git a/src/BugsnagUnity/Payload/HandledState.cs b/src/BugsnagUnity/Payload/HandledState.cs index ac2d4b0d4..818ac2ee9 100644 --- a/src/BugsnagUnity/Payload/HandledState.cs +++ b/src/BugsnagUnity/Payload/HandledState.cs @@ -19,6 +19,15 @@ internal static HandledState ForUnhandledException() return new HandledState(false, Severity.Error, SeverityReason.ForUnhandledException()); } + /// + /// Creates a HandledState object for an error report payload where the exception was logged and Config.ReportExceptionLogsAsHandled is true + /// + /// + internal static HandledState ForLoggedException() + { + return new HandledState(true, Severity.Error, SeverityReason.ForHandledException()); + } + /// /// Creates a HandledState object for an error report payload where the exception was handled by the application /// and notified manually. diff --git a/src/BugsnagUnity/Payload/StackTraceLine.cs b/src/BugsnagUnity/Payload/StackTraceLine.cs index cfa488128..76a3fe4c6 100644 --- a/src/BugsnagUnity/Payload/StackTraceLine.cs +++ b/src/BugsnagUnity/Payload/StackTraceLine.cs @@ -45,6 +45,10 @@ internal StackTrace(string stackTrace, StackTraceFormat format) : StackTraceLine.FromLogMessage(lines[i]); if (frame != null) { + if (frame.Method.StartsWith("at ")) + { + frame.Method = frame.Method.TrimStart('a', 't', ' '); + } frames.Add(frame); } } diff --git a/src/BugsnagUnity/UnityLogMessage.cs b/src/BugsnagUnity/UnityLogMessage.cs index 14edd35c9..3471e4f05 100644 --- a/src/BugsnagUnity/UnityLogMessage.cs +++ b/src/BugsnagUnity/UnityLogMessage.cs @@ -16,6 +16,14 @@ public UnityLogMessage(string condition, string stackTrace, LogType type) Type = type; } + public UnityLogMessage(Exception exception) + { + CreatedAt = DateTime.UtcNow; + Condition = exception.Message == null ? string.Empty : exception.Message; + StackTrace = exception.StackTrace == null ? string.Empty : exception.StackTrace; + Type = LogType.Exception; + } + public string Condition { get; } public string StackTrace { get; } @@ -23,5 +31,7 @@ public UnityLogMessage(string condition, string stackTrace, LogType type) public LogType Type { get; } public DateTime CreatedAt { get; } + + } } From 7c027870c4068551de219640b929f5e2b0789fdb Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Fri, 20 May 2022 12:41:11 +0200 Subject: [PATCH 08/25] Release v7.0.0 --- CHANGELOG.md | 8 ++++++-- UPGRADING.md | 12 ++++++++++++ build.cake | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d415ad5e3..3b30b7b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## TBD +## 7.0.0 (2022-04-23) -### Enhancements +This version contains **breaking** changes, as bugsnag-unity has been updated to use a more advanced Exception interceptor and existing grouping between errors in the Bugsnag dashboard may be broken. + +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.22.3 * Max reported threads can now be configured using manifest meta-data "com.bugsnag.android. MAX_REPORTED_THREADS" diff --git a/UPGRADING.md b/UPGRADING.md index cefa001f1..9af7318c3 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -1,6 +1,18 @@ Upgrading ========= +## 6.x to 7.x + +### The new Exception interceptor + +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 nested/inner exceptions. + +This means that uncaught C# exceptions previously reported will not group automatically in the Bugsnag dashboard with exceptions reported by the new notifier. + +All errors will still be reported, but you may wish to pay extra attention to new exceptions that come through once upgrading and group them accordingly. + +Handled errors and native errors will remain grouped and are not effected by this upgrade. + ## 5.x to 6.x ### Key points diff --git a/build.cake b/build.cake index 2190eb0fe..91fac5b36 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 = "6.3.1"; +var version = "7.0.0"; Task("Restore-NuGet-Packages") .Does(() => NuGetRestore(solution)); From d686b693a7cc43eb4435d3cdcd0194b1d037157c Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Fri, 20 May 2022 13:24:22 +0100 Subject: [PATCH 09/25] Update bugsnag-cocoa to v6.17.1 --- CHANGELOG.md | 2 ++ bugsnag-cocoa | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b30b7b90..ebd067d75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag A * Small performance improvements to `Bugnag.start` [bugsnag-android#1680](https://github.com/bugsnag/bugsnag-android/pull/1680) +* 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.1 (2022-04-06) ### Enhancements diff --git a/bugsnag-cocoa b/bugsnag-cocoa index efe6aa844..96f738f23 160000 --- a/bugsnag-cocoa +++ b/bugsnag-cocoa @@ -1 +1 @@ -Subproject commit efe6aa84466a455d6e22b0874b7f51a598073771 +Subproject commit 96f738f2382e47815cd036c728fcf29c2ca57b52 From 32f49f41e3b6338a4e310ca58bde10184aee13e0 Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Fri, 20 May 2022 14:55:33 +0200 Subject: [PATCH 10/25] Update UPGRADING.md Co-authored-by: Gareth Thackeray --- UPGRADING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 9af7318c3..0ab1f10c8 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -11,7 +11,7 @@ This means that uncaught C# exceptions previously reported will not group automa All errors will still be reported, but you may wish to pay extra attention to new exceptions that come through once upgrading and group them accordingly. -Handled errors and native errors will remain grouped and are not effected by this upgrade. +Handled errors and native crashes will continue grouping in the same way and are not affected by this upgrade. ## 5.x to 6.x From 1dc3a1f33a4f1aff87a182a95f843a312c78d92e Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Fri, 20 May 2022 14:55:56 +0200 Subject: [PATCH 11/25] Update UPGRADING.md Co-authored-by: Gareth Thackeray --- UPGRADING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 0ab1f10c8..2eeb1f79c 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -7,7 +7,7 @@ Upgrading 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 nested/inner exceptions. -This means that uncaught C# exceptions previously reported will not group automatically in the Bugsnag dashboard with exceptions reported by the new notifier. +This has slightly changed the format used for method names and signatures, which means that uncaught C# exceptions reported by `bugsnag-unity` V7+ will not group automatically in the Bugsnag dashboard with the equivalent exception reported by older versions of the library. All errors will still be reported, but you may wish to pay extra attention to new exceptions that come through once upgrading and group them accordingly. From b8457c11e36a555d5354eb25da05dd6f0d5e89ce Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Fri, 20 May 2022 14:56:05 +0200 Subject: [PATCH 12/25] Update UPGRADING.md Co-authored-by: Gareth Thackeray --- UPGRADING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 2eeb1f79c..4ca8f3da6 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -5,7 +5,7 @@ Upgrading ### The new Exception interceptor -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 nested/inner exceptions. +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. This has slightly changed the format used for method names and signatures, which means that uncaught C# exceptions reported by `bugsnag-unity` V7+ will not group automatically in the Bugsnag dashboard with the equivalent exception reported by older versions of the library. From da35fc837c268879e9ad98f442e607804d0ec3f2 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Tue, 24 May 2022 09:28:44 +0200 Subject: [PATCH 13/25] update upgrading --- UPGRADING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index 4ca8f3da6..7d8cde13b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -3,8 +3,6 @@ Upgrading ## 6.x to 7.x -### The new Exception interceptor - 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. This has slightly changed the format used for method names and signatures, which means that uncaught C# exceptions reported by `bugsnag-unity` V7+ will not group automatically in the Bugsnag dashboard with the equivalent exception reported by older versions of the library. From 55f029c69de4a12f9525e8b27a8b62f9b88c80b5 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Tue, 24 May 2022 09:34:11 +0200 Subject: [PATCH 14/25] update changelog --- CHANGELOG.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b30b7b90..db869f4ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,8 @@ This version contains **breaking** changes, as bugsnag-unity has been updated to 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. +In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag Android Notifier has been updated from v5.22.0 to [v5.22.3](https://github.com/bugsnag/bugsnag-android/releases/tag/v5.22.3) -* Update bugsnag-android to v5.22.3 - * Max reported threads can now be configured using manifest meta-data "com.bugsnag.android. MAX_REPORTED_THREADS" - [bugsnag-android#1655](https://github.com/bugsnag/bugsnag-android/pull/1655) - * Small improvement to startup performance (Bugsnag.start) - [bugsnag-android#1648](https://github.com/bugsnag/bugsnag-android/pull/1648) - * Fixed NDK stack-traces for libraries linked after `Bugsnag.start` was called - [bugsnag-android#1671](https://github.com/bugsnag/bugsnag-android/pull/1671) - * Fixed concurrency bug that could be triggered via the React Native plugin - [bugsnag-android#1679](https://github.com/bugsnag/bugsnag-android/pull/1679) - * Correctly report `device.locationStatus` on Android 12 onwards using `LocationManager.isLocationEnabled` - [bugsnag-android#1683](https://github.com/bugsnag/bugsnag-android/pull/1683) - * Small performance improvements to `Bugnag.start` - [bugsnag-android#1680](https://github.com/bugsnag/bugsnag-android/pull/1680) ## 6.3.1 (2022-04-06) From d5f1adec65966de6c199f5c2c5a7bf41d0c4338c Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Tue, 24 May 2022 09:38:41 +0200 Subject: [PATCH 15/25] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db869f4ac..f6d59fcdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This version contains **breaking** changes, as bugsnag-unity has been updated to 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 from v5.22.0 to [v5.22.3](https://github.com/bugsnag/bugsnag-android/releases/tag/v5.22.3) +In addition to the changes mentioned in the upgrade guide, the bundled Bugsnag Android Notifier has been updated from v5.22.0 to [v5.22.3](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5223-2022-05-12) ## 6.3.1 (2022-04-06) From ef002b6de940c8103d0214731cea930393de77da Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Tue, 24 May 2022 09:39:34 +0200 Subject: [PATCH 16/25] Update CHANGELOG.md Co-authored-by: Tom Longridge --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6d59fcdb..dd9679ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 7.0.0 (2022-04-23) -This version contains **breaking** changes, as bugsnag-unity has been updated to use a more advanced Exception interceptor and existing grouping between errors in the Bugsnag dashboard may be broken. +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 intercepts the C# exceptions objects, rather than parsing the information from Unity logs. Please see the [upgrade guide](./UPGRADING.md) for details of all the changes and instructions on how to upgrade. From 4c419aff8d158257dd8a6584ef6098be5ee68d8c Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Tue, 24 May 2022 10:48:51 +0200 Subject: [PATCH 17/25] Update UPGRADING.md Co-authored-by: Gareth Thackeray --- UPGRADING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 7d8cde13b..971c66cc4 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -7,7 +7,7 @@ When building using Unity 2019+, the Bugsnag SDK now uses a new method to interc This has slightly changed the format used for method names and signatures, which means that uncaught C# exceptions reported by `bugsnag-unity` V7+ will not group automatically in the Bugsnag dashboard with the equivalent exception reported by older versions of the library. -All errors will still be reported, but you may wish to pay extra attention to new exceptions that come through once upgrading and group them accordingly. +The impact of this will be that some errors will effectively be duplicated between older and newer versions of your app. Handled errors and native crashes will continue grouping in the same way and are not affected by this upgrade. From 259401e40c4ce3ac1aeb7c0c85f51ad5cdf0a71f Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Tue, 24 May 2022 10:49:08 +0200 Subject: [PATCH 18/25] Update UPGRADING.md Co-authored-by: Gareth Thackeray --- UPGRADING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.md b/UPGRADING.md index 971c66cc4..fcd7e8a4e 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -9,7 +9,7 @@ This has slightly changed the format used for method names and signatures, which The impact of this will be that some errors will effectively be duplicated between older and newer versions of your app. -Handled errors and native crashes will continue grouping in the same way and are not affected by this upgrade. +Handled errors and native crashes will maintain their existing groups and are not affected by this upgrade. ## 5.x to 6.x From 487bb7cebd252b2d5e7a0efd824cb2e0903d79a8 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Tue, 24 May 2022 11:26:29 +0200 Subject: [PATCH 19/25] run tests in focus [full ci] --- .../maze_runner/ProjectSettings/ProjectSettings.asset | 8 ++++---- features/steps/unity_steps.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/features/fixtures/maze_runner/ProjectSettings/ProjectSettings.asset b/features/fixtures/maze_runner/ProjectSettings/ProjectSettings.asset index cd113e028..90f484262 100644 --- a/features/fixtures/maze_runner/ProjectSettings/ProjectSettings.asset +++ b/features/fixtures/maze_runner/ProjectSettings/ProjectSettings.asset @@ -52,7 +52,7 @@ PlayerSettings: m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 - displayResolutionDialog: 1 + displayResolutionDialog: 0 iosUseCustomAppBackgroundBehavior: 0 iosAllowHTTPDownload: 1 allowedAutorotateToPortrait: 1 @@ -68,8 +68,8 @@ PlayerSettings: androidBlitType: 0 defaultIsNativeResolution: 1 macRetinaSupport: 1 - runInBackground: 0 - captureSingleScreen: 0 + runInBackground: 1 + captureSingleScreen: 1 muteOtherAudioSources: 0 Prepare IOS For Recording: 0 Force IOS Speakers When Recording: 0 @@ -92,7 +92,7 @@ PlayerSettings: visibleInBackground: 1 allowFullscreenSwitch: 1 graphicsJobMode: 0 - fullscreenMode: 1 + fullscreenMode: 0 xboxSpeechDB: 0 xboxEnableHeadOrientation: 0 xboxEnableGuest: 0 diff --git a/features/steps/unity_steps.rb b/features/steps/unity_steps.rb index 2d82383eb..de7697ce8 100644 --- a/features/steps/unity_steps.rb +++ b/features/steps/unity_steps.rb @@ -146,7 +146,7 @@ def press_at(y) Maze::Runner.environment['MAZE_ENDPOINT'] = endpoint # Call executable directly rather than use open, which flakes on CI - command = "#{Maze.config.app}/Contents/MacOS/Mazerunner --args -batchmode -nographics" + command = "#{Maze.config.app}/Contents/MacOS/Mazerunner --args" Maze::Runner.run_command(command) when 'windows' From 8f19e3b08d3768d6bd9fc28a63cde6ba5c1f7345 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 24 May 2022 17:16:17 +0100 Subject: [PATCH 20/25] dep: bump bugsnag-android to v5.22.4 --- CHANGELOG.md | 6 ++++++ bugsnag-android | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd9679ada..bdbc49f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## TBD + +### Enhancements + +* Updates the bugsnag-android dependency from v5.22.0 to [v5.22.4](https://github.com/bugsnag/bugsnag-android/releases/tag/v5.22.4) + ## 7.0.0 (2022-04-23) 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 intercepts the C# exceptions objects, rather than parsing the information from Unity logs. diff --git a/bugsnag-android b/bugsnag-android index 55c2fe1c4..3597e9e3b 160000 --- a/bugsnag-android +++ b/bugsnag-android @@ -1 +1 @@ -Subproject commit 55c2fe1c4a693472fcf64220acdb8d225fd36273 +Subproject commit 3597e9e3bd303787303178534f46a9c282538b2d From 390e948ea13c6acccff92a40e371c31e7bfba1bd Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Wed, 25 May 2022 10:32:13 +0200 Subject: [PATCH 21/25] Update changelog --- CHANGELOG.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92cabd0db..df9bc5b94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,14 @@ # Changelog -## TBD - -### Enhancements - -* Updates the bugsnag-android dependency from v5.22.0 to [v5.22.4](https://github.com/bugsnag/bugsnag-android/releases/tag/v5.22.4) - ## 7.0.0 (2022-04-23) 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 intercepts the C# exceptions objects, rather than parsing the information from Unity logs. 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 from v5.22.0 to [v5.22.3](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5223-2022-05-12) +### 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) From f710b3403af74903a84cb06eb10238fa1ba506da Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Wed, 25 May 2022 14:59:08 +0200 Subject: [PATCH 22/25] fix(metadata): add automatic Windows app type for WSAPlayer types (#557) --- src/BugsnagUnity/Payload/App.cs | 3 ++ .../Windows/BugsnagUnity.Windows.dll.meta | 29 ++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/BugsnagUnity/Payload/App.cs b/src/BugsnagUnity/Payload/App.cs index fd63a15fd..8be172765 100644 --- a/src/BugsnagUnity/Payload/App.cs +++ b/src/BugsnagUnity/Payload/App.cs @@ -109,6 +109,9 @@ private string GetAppType(Configuration configuration) return "MacOS"; case RuntimePlatform.WindowsPlayer: case RuntimePlatform.WindowsEditor: + case RuntimePlatform.WSAPlayerARM: + case RuntimePlatform.WSAPlayerX64: + case RuntimePlatform.WSAPlayerX86: return "Windows"; case RuntimePlatform.LinuxPlayer: case RuntimePlatform.LinuxEditor: diff --git a/unity/PackageProject/Assets/Bugsnag/Plugins/Windows/BugsnagUnity.Windows.dll.meta b/unity/PackageProject/Assets/Bugsnag/Plugins/Windows/BugsnagUnity.Windows.dll.meta index e27b26446..978b1c9a6 100644 --- a/unity/PackageProject/Assets/Bugsnag/Plugins/Windows/BugsnagUnity.Windows.dll.meta +++ b/unity/PackageProject/Assets/Bugsnag/Plugins/Windows/BugsnagUnity.Windows.dll.meta @@ -1,28 +1,39 @@ fileFormatVersion: 2 guid: 985672bb978624e548cfe578ccf27093 -timeCreated: 1536884316 PluginImporter: externalObjects: {} serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 platformData: - first: '': Any second: enabled: 0 settings: + Exclude Android: 1 Exclude Editor: 1 Exclude Linux: 1 Exclude Linux64: 1 Exclude LinuxUniversal: 1 Exclude OSXUniversal: 1 + Exclude WebGL: 1 Exclude Win: 0 Exclude Win64: 0 + Exclude WindowsStoreApps: 0 - first: - Any: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + - first: + Any: second: enabled: 0 settings: {} @@ -57,7 +68,7 @@ PluginImporter: second: enabled: 0 settings: - CPU: x86_64 + CPU: AnyCPU - first: Standalone: LinuxUniversal second: @@ -90,9 +101,13 @@ PluginImporter: - first: Windows Store Apps: WindowsStoreApps second: - enabled: 0 + enabled: 1 settings: CPU: AnyCPU + DontProcess: false + PlaceholderPath: + SDK: AnySDK + ScriptingBackend: AnyScriptingBackend - first: iPhone: iOS second: @@ -103,6 +118,6 @@ PluginImporter: second: enabled: 0 settings: {} - userData: - assetBundleName: - assetBundleVariant: + userData: + assetBundleName: + assetBundleVariant: From c50434ed828d55d19c124c1f35a4d5dbe0b08c67 Mon Sep 17 00:00:00 2001 From: Steve Kirkland-Walton Date: Fri, 27 May 2022 10:20:43 +0100 Subject: [PATCH 23/25] Increase timeout for macOS e2e tests --- .buildkite/pipeline.full.yml | 6 +++--- .buildkite/pipeline.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.buildkite/pipeline.full.yml b/.buildkite/pipeline.full.yml index 9abe8c5dd..44b0095df 100644 --- a/.buildkite/pipeline.full.yml +++ b/.buildkite/pipeline.full.yml @@ -72,7 +72,7 @@ steps: # Run macOS desktop tests # - label: Run MacOS e2e tests for Unity 2018 - timeout_in_minutes: 30 + timeout_in_minutes: 60 depends_on: 'cocoa-webgl-2018-fixtures' agents: queue: macos-12-arm-unity @@ -89,7 +89,7 @@ steps: - scripts/ci-run-macos-tests.sh - label: Run MacOS e2e tests for Unity 2019 - timeout_in_minutes: 30 + timeout_in_minutes: 60 depends_on: 'cocoa-webgl-2019-fixtures' agents: queue: macos-12-arm-unity @@ -106,7 +106,7 @@ steps: - scripts/ci-run-macos-tests.sh - label: Run MacOS e2e tests for Unity 2021 - timeout_in_minutes: 30 + timeout_in_minutes: 60 depends_on: 'cocoa-webgl-2021-fixtures' agents: queue: macos-12-arm-unity diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 25965c971..e49bbabcf 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -49,7 +49,7 @@ steps: # Run desktop tests # - label: Run MacOS e2e tests for Unity 2020 - timeout_in_minutes: 30 + timeout_in_minutes: 60 depends_on: 'cocoa-webgl-2020-fixtures' agents: queue: macos-12-arm-unity From b9859f9472881bc8e17a31b81ecd3bea66514997 Mon Sep 17 00:00:00 2001 From: Richard Elms Date: Mon, 30 May 2022 10:19:28 +0200 Subject: [PATCH 24/25] refac(client): remove unused send method and legacy session tracker access --- UPGRADING.md | 9 +++++++++ src/BugsnagUnity/Bugsnag.cs | 6 +----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/UPGRADING.md b/UPGRADING.md index fcd7e8a4e..a0c622661 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -11,6 +11,15 @@ The impact of this will be that some errors will effectively be duplicated betwe Handled errors and native crashes will maintain their existing groups and are not affected by this upgrade. +#### Deprecation summary + +The following methods have been removed from the `Bugsnag` client: + +`Bugsnag.SessionTracking;` Please see the [capturing sessions](https://docs.bugsnag.com/platforms/unity/capturing-sessions/) section of our documentation for details on working with sessions. + +`Bugsnag.Send(IPayload payload);` + + ## 5.x to 6.x ### Key points diff --git a/src/BugsnagUnity/Bugsnag.cs b/src/BugsnagUnity/Bugsnag.cs index 0080fc5a1..215eece35 100644 --- a/src/BugsnagUnity/Bugsnag.cs +++ b/src/BugsnagUnity/Bugsnag.cs @@ -34,14 +34,10 @@ public static void Start(Configuration configuration) } } - static Client InternalClient { get; set; } + private static Client InternalClient { get; set; } private static IClient Client => InternalClient; - public static ISessionTracker SessionTracking => Client.SessionTracking; - - public static void Send(IPayload payload) => Client.Send(payload); - public static void Notify(string name, string message, string stackTrace) => InternalClient.Notify(name, message, stackTrace, null); public static void Notify(string name, string message, string stackTrace, Func callback) => InternalClient.Notify(name, message, stackTrace, callback); From 4a4bcf9ad66e809fc57e5924ae2e5eaf2e5f6896 Mon Sep 17 00:00:00 2001 From: rich-bugsnag <83639642+rich-bugsnag@users.noreply.github.com> Date: Mon, 30 May 2022 10:57:05 +0200 Subject: [PATCH 25/25] Update CHANGELOG.md Co-authored-by: Gareth Thackeray --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18a236ae4..c98701d7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 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 intercepts the C# exceptions objects, rather than parsing the information from Unity logs. +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.