Skip to content

Commit

Permalink
Merge pull request #702 from bugsnag/next
Browse files Browse the repository at this point in the history
Release v7.5.2
  • Loading branch information
richardelms authored Mar 8, 2023
2 parents e2744cb + 724bbe0 commit 5b53303
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 85 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 7.5.2 (2023-03-08)

### 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

* Update bugsnag-android from v5.28.3 to [v5.28.4](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5284-2023-02-08)

## 7.5.1 (2023-02-08)

### Dependency updates
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ bundle exec maze-runner features/handled_errors.feature
Once the UnityPackage release is confirmed a UPM release should be deployed
1. Checkout the release commit on `master`
1. Make sure that the package used in the github release is present in the root of the repo.
2. Build the upm package by running the `build-upm-package.sh` script in the upm-tools directory. You should pass the version number of the release like so `./build-upm-package.sh 7.x.x`. You must run the script from within the upm-tools folder. This will build the upm package in a directory called `upm-package`
Expand Down
2 changes: 1 addition & 1 deletion bugsnag-android
Submodule bugsnag-android updated 35 files
+114 −0 .buildkite/pipeline.bb.yml
+190 −0 .buildkite/pipeline.bs.yml
+32 −82 .buildkite/pipeline.full.yml
+6 −214 .buildkite/pipeline.yml
+11 −0 .buildkite/pipeline_trigger.sh
+9 −0 CHANGELOG.md
+1 −1 Gemfile
+23 −10 Gemfile.lock
+1 −1 bugsnag-android-core/src/main/java/com/bugsnag/android/Notifier.kt
+1 −0 bugsnag-plugin-android-ndk/detekt-baseline.xml
+224 −0 bugsnag-plugin-android-ndk/src/androidTest/java/com/bugsnag/android/ndk/migrations/EventMigrationV12Tests.kt
+1 −0 bugsnag-plugin-android-ndk/src/main/CMakeLists.txt
+1 −1 bugsnag-plugin-android-ndk/src/main/jni/event.h
+1 −1 bugsnag-plugin-android-ndk/src/main/jni/external/libunwindstack-ndk
+20 −7 bugsnag-plugin-android-ndk/src/main/jni/featureflags.c
+66 −0 bugsnag-plugin-android-ndk/src/main/jni/utils/seqlock.c
+34 −0 bugsnag-plugin-android-ndk/src/main/jni/utils/seqlock.h
+94 −10 bugsnag-plugin-android-ndk/src/main/jni/utils/serializer/event_reader.c
+12 −0 bugsnag-plugin-android-ndk/src/main/jni/utils/serializer/event_writer.c
+36 −0 bugsnag-plugin-android-ndk/src/main/jni/utils/serializer/migrate.h
+1 −0 bugsnag-plugin-android-ndk/src/test/CMakeLists.txt
+139 −10 bugsnag-plugin-android-ndk/src/test/cpp/migrations/EventMigrationV11Tests.cpp
+202 −0 bugsnag-plugin-android-ndk/src/test/cpp/migrations/EventMigrationV12Tests.cpp
+27 −6 docker-compose.yml
+1 −1 docs/MAZERUNNER.md
+1 −1 examples/sdk-app-example/app/build.gradle
+1 −0 features/fixtures/mazerunner/app/detekt-baseline.xml
+37 −4 features/fixtures/mazerunner/app/src/main/java/com/bugsnag/android/mazerunner/MainActivity.kt
+3 −1 features/full_tests/auto_notify.feature
+4 −0 features/full_tests/detect_anr_cxx.feature
+5 −1 features/full_tests/detect_anr_jvm.feature
+2 −0 features/full_tests/load_configuration.feature
+12 −2 features/steps/android_steps.rb
+16 −2 features/support/env.rb
+1 −1 gradle.properties
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.1";
var version = "7.5.2";

Task("Restore-NuGet-Packages")
.Does(() => NuGetRestore(solution));
Expand Down
1 change: 0 additions & 1 deletion features/csharp/csharp_callbacks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Feature: Callbacks
And the exception "message" equals "Error 2"
And all possible parameters have been edited in a callback

@skip_android #pending PLAT-9092
Scenario: Callback passed directly to Notify
When I run the game in the "CallbackInNotify" state
And I wait to receive 1 error
Expand Down
4 changes: 1 addition & 3 deletions features/csharp/csharp_events.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Feature: csharp events
Background:
Given I clear the Bugsnag cache

@skip_android #pending PLAT-9092
Scenario: Notify smoke test
When I run the game in the "NotifySmokeTest" state
And I wait to receive an error
Expand All @@ -13,8 +12,7 @@ Feature: csharp events
And the event "unhandled" is false
And custom metadata is included in the event
And the stack frame methods should match:
| NotifySmokeTest.Run() |
| ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) |
| NotifySmokeTest.Run() | Main+<RunNextMazeCommand>d__5.MoveNext() |
And expected device metadata is included in the event
And expected app metadata is included in the event

Expand Down
16 changes: 4 additions & 12 deletions src/BugsnagUnity/Bugsnag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,13 @@ public static void Start(Configuration configuration)

private static IClient Client => InternalClient;

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<IEvent, bool> callback = null) => InternalClient.Notify(name, message, stackTrace, callback);

public static void Notify(string name, string message, string stackTrace, Func<IEvent, bool> callback) => InternalClient.Notify(name, message, stackTrace, callback);
public static void Notify(System.Exception exception, string stacktrace, Func<IEvent, bool> callback = null) => InternalClient.Notify(exception, stacktrace, callback);

public static void Notify(System.Exception exception) => InternalClient.Notify(exception, 3);
public static void Notify(System.Exception exception, Func<IEvent, bool> callback = null) => InternalClient.Notify(exception, callback);

public static void Notify(System.Exception exception, string stacktrace) => InternalClient.Notify(exception, stacktrace, null);

public static void Notify(System.Exception exception, string stacktrace, Func<IEvent, bool> callback) => InternalClient.Notify(exception, stacktrace, callback);

public static void Notify(System.Exception exception, Func<IEvent, bool> callback) => InternalClient.Notify(exception, callback, 3);

public static void Notify(System.Exception exception, Severity severity) => InternalClient.Notify(exception, severity, 3);

public static void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback) => InternalClient.Notify(exception, severity, callback, 3);
public static void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback = null) => InternalClient.Notify(exception, severity, callback);

public static List<Breadcrumb> Breadcrumbs => Client.Breadcrumbs.Retrieve();

Expand Down
69 changes: 18 additions & 51 deletions src/BugsnagUnity/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Specialized;
using System.Diagnostics;
using System.Linq;
using System.ComponentModel;
using System.Threading;
using UnityEngine;
using UnityEngine.SceneManagement;
Expand Down Expand Up @@ -82,7 +81,7 @@ public void LogException(System.Exception exception, UnityEngine.Object context)
if (shouldSend)
{
var handledState = _config.ReportExceptionLogsAsHandled ? HandledState.ForLoggedException() : HandledState.ForUnhandledException();
_client.Notify(exception, handledState, null, 3);
_client.Notify(exception, handledState, null);
}
}
if (_oldLogHandler != null)
Expand All @@ -108,6 +107,7 @@ private void SetupAdvancedExceptionInterceptor()

public Client(INativeClient nativeClient)
{
InitMainthreadDispatcher();
NativeClient = nativeClient;
CacheManager = new CacheManager(Configuration);
PayloadManager = new PayloadManager(CacheManager);
Expand All @@ -120,8 +120,6 @@ public Client(INativeClient nativeClient)
InitMetadata();
InitFeatureFlags();
InitCounters();
ListenForSceneLoad();
InitLogHandlers();
if (_isUnity2019OrHigher)
{
SetupAdvancedExceptionInterceptor();
Expand All @@ -131,6 +129,13 @@ public Client(INativeClient nativeClient)
CheckForMisconfiguredEndpointsWarning();
AddBugsnagLoadedBreadcrumb();
_delivery.StartDeliveringCachedPayloads();
ListenForSceneLoad();
InitLogHandlers();
}

private void InitMainthreadDispatcher()
{
MainThreadDispatchBehaviour.Instance();
}

private bool IsUnity2019OrHigher()
Expand Down Expand Up @@ -174,7 +179,7 @@ private void InitTimingTracker()
private void InitLogHandlers()
{
Application.logMessageReceivedThreaded += MultiThreadedNotify;
Application.logMessageReceived += Notify;
Application.logMessageReceived += NotifyFromUnityLog;
}

private void InitCounters()
Expand Down Expand Up @@ -271,19 +276,11 @@ void MultiThreadedNotify(string condition, string stackTrace, LogType logType)
// Discard messages from the main thread as they will be reported separately
if (!ReferenceEquals(Thread.CurrentThread, MainThread))
{
Notify(condition, stackTrace, logType);
NotifyFromUnityLog(condition, stackTrace, logType);
}
}

/// <summary>
/// Notify a Unity log message if it the client has been configured to
/// notify at the specified level, if not leave a breadcrumb with the log
/// message.
/// </summary>
/// <param name="condition"></param>
/// <param name="stackTrace"></param>
/// <param name="logType"></param>
void Notify(string condition, string stackTrace, LogType logType)
private void NotifyFromUnityLog(string condition, string stackTrace, LogType logType)
{
if (!Configuration.EnabledErrorTypes.UnityLog)
{
Expand Down Expand Up @@ -330,52 +327,22 @@ public void Notify(System.Exception exception, string stacktrace, Func<IEvent, b
Notify(exceptions, HandledState.ForHandledException(), callback, LogType.Exception);
}

public void Notify(System.Exception exception)
{
Notify(exception, 3);
}

internal void Notify(System.Exception exception, int level)
{
Notify(exception, HandledState.ForHandledException(), null, level);
}

public void Notify(System.Exception exception, Func<IEvent, bool> callback)
{
Notify(exception, callback, 3);
}

internal void Notify(System.Exception exception, Func<IEvent, bool> callback, int level)
{
Notify(exception, HandledState.ForHandledException(), callback, level);
}

public void Notify(System.Exception exception, Severity severity)
{
Notify(exception, severity, 3);
}

internal void Notify(System.Exception exception, Severity severity, int level)
{
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), null, level);
Notify(exception, HandledState.ForHandledException(), callback);
}

public void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback)
{
Notify(exception, severity, callback, 3);
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), callback);
}

internal void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback, int level)
{
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), callback, level);
}

void Notify(System.Exception exception, HandledState handledState, Func<IEvent, bool> callback, int level)
void Notify(System.Exception exception, HandledState handledState, Func<IEvent, bool> callback)
{
// we need to generate a substitute stacktrace here as if we are not able
// to generate one from the exception that we are given then we are not able
// to do this inside of the IEnumerator generator code
var substitute = new System.Diagnostics.StackTrace(level, true).GetFrames();
var substitute = new System.Diagnostics.StackTrace(true).GetFrames();
var errors = new Errors(exception, substitute).ToArray();
foreach (var error in errors)
{
Expand All @@ -387,15 +354,15 @@ void Notify(System.Exception exception, HandledState handledState, Func<IEvent,
Notify(errors, handledState, callback, null);
}

void Notify(Error[] exceptions, HandledState handledState, Func<IEvent, bool> callback, LogType? logType)
private void Notify(Error[] exceptions, HandledState handledState, Func<IEvent, bool> callback, LogType? logType)
{
if (!ShouldSendRequests() || EventContainsDiscardedClass(exceptions) || !Configuration.Endpoints.IsValid)
{
return;
}


if (!object.ReferenceEquals(Thread.CurrentThread, MainThread))
if (!ReferenceEquals(Thread.CurrentThread, MainThread))
{
try
{
Expand Down
4 changes: 0 additions & 4 deletions src/BugsnagUnity/IClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ internal interface IClient : IMetadataEditor, IFeatureFlagStore

void Send(IPayload payload);

void Notify(System.Exception exception);

void Notify(System.Exception exception, Func<IEvent, bool> callback);

void Notify(System.Exception exception, Severity severity);

void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback);

void Notify(System.Exception exception, string stacktrace, Func<IEvent, bool> callback);
Expand Down
33 changes: 33 additions & 0 deletions tests/BugsnagUnity.Tests/OverloadCheck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
namespace BugsnagUnity.Tests
{
public class OverloadCheck
{

// this method never runs and is just used to check that no notify overides are accidentally broken during refactoring
// if one is broken then the notifier will not compile
private void Check()
{
Bugsnag.Notify("name", "message", "stacktrace");

Bugsnag.Notify("name", "message", "stacktrace", CallBack);

Bugsnag.Notify(new Exception());

Bugsnag.Notify(new Exception(), "stacktrace");

Bugsnag.Notify(new Exception(), "stacktrace", CallBack);

Bugsnag.Notify(new Exception(), CallBack);

Bugsnag.Notify(new Exception(), Severity.Error);

Bugsnag.Notify(new Exception(), Severity.Error, CallBack);
}

private bool CallBack(IEvent e)
{
return true;
}
}
}
3 changes: 2 additions & 1 deletion upm-tools/build-edm-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ cp EDM/BugsnagAndroidDependencies.xml "$PACKAGE_DIR/Editor"
cp EDM/BugsnagAndroidDependencies.xml.meta "$PACKAGE_DIR/Editor"

# Change the readme title to reference EDM4U
sed -i '' "s/Bugsnag SDK for Unity/Bugsnag SDK for Unity Including EDM4U Support/g" "$PACKAGE_DIR/README.md"
sed -i '' "s/Bugsnag SDK for Unity/Bugsnag SDK for Unity Including EDM4U Support/g" "$PACKAGE_DIR/README.md"
sed -i '' "s/bugsnag-unity-upm.git/bugsnag-unity-upm-edm4u.git/g" "$PACKAGE_DIR/README.md"
13 changes: 3 additions & 10 deletions upm-tools/build-upm-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,12 @@ then
exit 1
fi

#Build the plugin
echo "Building the sdk"

cd ..

rake plugin:export

cd upm-tools

#Check for the release package
echo "Checking for the release package"

# make sure the package of the release is present after building
if [ ! -f "$PACKAGE_FILE" ]; then
echo "$PACKAGE_FILE not found, please check for build errors."
echo "$PACKAGE_FILE not found, please provide a release package."
exit 1
fi

Expand Down

0 comments on commit 5b53303

Please sign in to comment.