Skip to content

Commit 5b53303

Browse files
authored
Merge pull request #702 from bugsnag/next
Release v7.5.2
2 parents e2744cb + 724bbe0 commit 5b53303

File tree

12 files changed

+76
-85
lines changed

12 files changed

+76
-85
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## 7.5.2 (2023-03-08)
4+
5+
### Bug fixes
6+
7+
* 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)
8+
9+
* Fix an issue causing empty stacktraces in some Android events. [#700](https://github.com/bugsnag/bugsnag-unity/pull/700)
10+
11+
### Dependency updates
12+
13+
* 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)
14+
315
## 7.5.1 (2023-02-08)
416

517
### Dependency updates

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ bundle exec maze-runner features/handled_errors.feature
133133
134134
Once the UnityPackage release is confirmed a UPM release should be deployed
135135
136-
1. Checkout the release commit on `master`
136+
1. Make sure that the package used in the github release is present in the root of the repo.
137137
138138
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`
139139

bugsnag-android

Submodule bugsnag-android updated 35 files

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var target = Argument("target", "Default");
55
var solution = File("./BugsnagUnity.sln");
66
var configuration = Argument("configuration", "Release");
77
var project = File("./src/BugsnagUnity/BugsnagUnity.csproj");
8-
var version = "7.5.1";
8+
var version = "7.5.2";
99

1010
Task("Restore-NuGet-Packages")
1111
.Does(() => NuGetRestore(solution));

features/csharp/csharp_callbacks.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Feature: Callbacks
4545
And the exception "message" equals "Error 2"
4646
And all possible parameters have been edited in a callback
4747

48-
@skip_android #pending PLAT-9092
4948
Scenario: Callback passed directly to Notify
5049
When I run the game in the "CallbackInNotify" state
5150
And I wait to receive 1 error

features/csharp/csharp_events.feature

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Feature: csharp events
33
Background:
44
Given I clear the Bugsnag cache
55

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

src/BugsnagUnity/Bugsnag.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,13 @@ public static void Start(Configuration configuration)
3838

3939
private static IClient Client => InternalClient;
4040

41-
public static void Notify(string name, string message, string stackTrace) => InternalClient.Notify(name, message, stackTrace, null);
41+
public static void Notify(string name, string message, string stackTrace, Func<IEvent, bool> callback = null) => InternalClient.Notify(name, message, stackTrace, callback);
4242

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

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

47-
public static void Notify(System.Exception exception, string stacktrace) => InternalClient.Notify(exception, stacktrace, null);
48-
49-
public static void Notify(System.Exception exception, string stacktrace, Func<IEvent, bool> callback) => InternalClient.Notify(exception, stacktrace, callback);
50-
51-
public static void Notify(System.Exception exception, Func<IEvent, bool> callback) => InternalClient.Notify(exception, callback, 3);
52-
53-
public static void Notify(System.Exception exception, Severity severity) => InternalClient.Notify(exception, severity, 3);
54-
55-
public static void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback) => InternalClient.Notify(exception, severity, callback, 3);
47+
public static void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback = null) => InternalClient.Notify(exception, severity, callback);
5648

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

src/BugsnagUnity/Client.cs

Lines changed: 18 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.Specialized;
44
using System.Diagnostics;
55
using System.Linq;
6-
using System.ComponentModel;
76
using System.Threading;
87
using UnityEngine;
98
using UnityEngine.SceneManagement;
@@ -82,7 +81,7 @@ public void LogException(System.Exception exception, UnityEngine.Object context)
8281
if (shouldSend)
8382
{
8483
var handledState = _config.ReportExceptionLogsAsHandled ? HandledState.ForLoggedException() : HandledState.ForUnhandledException();
85-
_client.Notify(exception, handledState, null, 3);
84+
_client.Notify(exception, handledState, null);
8685
}
8786
}
8887
if (_oldLogHandler != null)
@@ -108,6 +107,7 @@ private void SetupAdvancedExceptionInterceptor()
108107

109108
public Client(INativeClient nativeClient)
110109
{
110+
InitMainthreadDispatcher();
111111
NativeClient = nativeClient;
112112
CacheManager = new CacheManager(Configuration);
113113
PayloadManager = new PayloadManager(CacheManager);
@@ -120,8 +120,6 @@ public Client(INativeClient nativeClient)
120120
InitMetadata();
121121
InitFeatureFlags();
122122
InitCounters();
123-
ListenForSceneLoad();
124-
InitLogHandlers();
125123
if (_isUnity2019OrHigher)
126124
{
127125
SetupAdvancedExceptionInterceptor();
@@ -131,6 +129,13 @@ public Client(INativeClient nativeClient)
131129
CheckForMisconfiguredEndpointsWarning();
132130
AddBugsnagLoadedBreadcrumb();
133131
_delivery.StartDeliveringCachedPayloads();
132+
ListenForSceneLoad();
133+
InitLogHandlers();
134+
}
135+
136+
private void InitMainthreadDispatcher()
137+
{
138+
MainThreadDispatchBehaviour.Instance();
134139
}
135140

136141
private bool IsUnity2019OrHigher()
@@ -174,7 +179,7 @@ private void InitTimingTracker()
174179
private void InitLogHandlers()
175180
{
176181
Application.logMessageReceivedThreaded += MultiThreadedNotify;
177-
Application.logMessageReceived += Notify;
182+
Application.logMessageReceived += NotifyFromUnityLog;
178183
}
179184

180185
private void InitCounters()
@@ -271,19 +276,11 @@ void MultiThreadedNotify(string condition, string stackTrace, LogType logType)
271276
// Discard messages from the main thread as they will be reported separately
272277
if (!ReferenceEquals(Thread.CurrentThread, MainThread))
273278
{
274-
Notify(condition, stackTrace, logType);
279+
NotifyFromUnityLog(condition, stackTrace, logType);
275280
}
276281
}
277282

278-
/// <summary>
279-
/// Notify a Unity log message if it the client has been configured to
280-
/// notify at the specified level, if not leave a breadcrumb with the log
281-
/// message.
282-
/// </summary>
283-
/// <param name="condition"></param>
284-
/// <param name="stackTrace"></param>
285-
/// <param name="logType"></param>
286-
void Notify(string condition, string stackTrace, LogType logType)
283+
private void NotifyFromUnityLog(string condition, string stackTrace, LogType logType)
287284
{
288285
if (!Configuration.EnabledErrorTypes.UnityLog)
289286
{
@@ -330,52 +327,22 @@ public void Notify(System.Exception exception, string stacktrace, Func<IEvent, b
330327
Notify(exceptions, HandledState.ForHandledException(), callback, LogType.Exception);
331328
}
332329

333-
public void Notify(System.Exception exception)
334-
{
335-
Notify(exception, 3);
336-
}
337-
338-
internal void Notify(System.Exception exception, int level)
339-
{
340-
Notify(exception, HandledState.ForHandledException(), null, level);
341-
}
342-
343330
public void Notify(System.Exception exception, Func<IEvent, bool> callback)
344331
{
345-
Notify(exception, callback, 3);
346-
}
347-
348-
internal void Notify(System.Exception exception, Func<IEvent, bool> callback, int level)
349-
{
350-
Notify(exception, HandledState.ForHandledException(), callback, level);
351-
}
352-
353-
public void Notify(System.Exception exception, Severity severity)
354-
{
355-
Notify(exception, severity, 3);
356-
}
357-
358-
internal void Notify(System.Exception exception, Severity severity, int level)
359-
{
360-
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), null, level);
332+
Notify(exception, HandledState.ForHandledException(), callback);
361333
}
362334

363335
public void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback)
364336
{
365-
Notify(exception, severity, callback, 3);
337+
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), callback);
366338
}
367339

368-
internal void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback, int level)
369-
{
370-
Notify(exception, HandledState.ForUserSpecifiedSeverity(severity), callback, level);
371-
}
372-
373-
void Notify(System.Exception exception, HandledState handledState, Func<IEvent, bool> callback, int level)
340+
void Notify(System.Exception exception, HandledState handledState, Func<IEvent, bool> callback)
374341
{
375342
// we need to generate a substitute stacktrace here as if we are not able
376343
// to generate one from the exception that we are given then we are not able
377344
// to do this inside of the IEnumerator generator code
378-
var substitute = new System.Diagnostics.StackTrace(level, true).GetFrames();
345+
var substitute = new System.Diagnostics.StackTrace(true).GetFrames();
379346
var errors = new Errors(exception, substitute).ToArray();
380347
foreach (var error in errors)
381348
{
@@ -387,15 +354,15 @@ void Notify(System.Exception exception, HandledState handledState, Func<IEvent,
387354
Notify(errors, handledState, callback, null);
388355
}
389356

390-
void Notify(Error[] exceptions, HandledState handledState, Func<IEvent, bool> callback, LogType? logType)
357+
private void Notify(Error[] exceptions, HandledState handledState, Func<IEvent, bool> callback, LogType? logType)
391358
{
392359
if (!ShouldSendRequests() || EventContainsDiscardedClass(exceptions) || !Configuration.Endpoints.IsValid)
393360
{
394361
return;
395362
}
396363

397364

398-
if (!object.ReferenceEquals(Thread.CurrentThread, MainThread))
365+
if (!ReferenceEquals(Thread.CurrentThread, MainThread))
399366
{
400367
try
401368
{

src/BugsnagUnity/IClient.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ internal interface IClient : IMetadataEditor, IFeatureFlagStore
1717

1818
void Send(IPayload payload);
1919

20-
void Notify(System.Exception exception);
21-
2220
void Notify(System.Exception exception, Func<IEvent, bool> callback);
2321

24-
void Notify(System.Exception exception, Severity severity);
25-
2622
void Notify(System.Exception exception, Severity severity, Func<IEvent, bool> callback);
2723

2824
void Notify(System.Exception exception, string stacktrace, Func<IEvent, bool> callback);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
namespace BugsnagUnity.Tests
3+
{
4+
public class OverloadCheck
5+
{
6+
7+
// this method never runs and is just used to check that no notify overides are accidentally broken during refactoring
8+
// if one is broken then the notifier will not compile
9+
private void Check()
10+
{
11+
Bugsnag.Notify("name", "message", "stacktrace");
12+
13+
Bugsnag.Notify("name", "message", "stacktrace", CallBack);
14+
15+
Bugsnag.Notify(new Exception());
16+
17+
Bugsnag.Notify(new Exception(), "stacktrace");
18+
19+
Bugsnag.Notify(new Exception(), "stacktrace", CallBack);
20+
21+
Bugsnag.Notify(new Exception(), CallBack);
22+
23+
Bugsnag.Notify(new Exception(), Severity.Error);
24+
25+
Bugsnag.Notify(new Exception(), Severity.Error, CallBack);
26+
}
27+
28+
private bool CallBack(IEvent e)
29+
{
30+
return true;
31+
}
32+
}
33+
}

upm-tools/build-edm-package.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ cp EDM/BugsnagAndroidDependencies.xml "$PACKAGE_DIR/Editor"
1414
cp EDM/BugsnagAndroidDependencies.xml.meta "$PACKAGE_DIR/Editor"
1515

1616
# Change the readme title to reference EDM4U
17-
sed -i '' "s/Bugsnag SDK for Unity/Bugsnag SDK for Unity Including EDM4U Support/g" "$PACKAGE_DIR/README.md"
17+
sed -i '' "s/Bugsnag SDK for Unity/Bugsnag SDK for Unity Including EDM4U Support/g" "$PACKAGE_DIR/README.md"
18+
sed -i '' "s/bugsnag-unity-upm.git/bugsnag-unity-upm-edm4u.git/g" "$PACKAGE_DIR/README.md"

upm-tools/build-upm-package.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,12 @@ then
2323
exit 1
2424
fi
2525

26-
#Build the plugin
27-
echo "Building the sdk"
28-
29-
cd ..
30-
31-
rake plugin:export
32-
33-
cd upm-tools
34-
26+
#Check for the release package
27+
echo "Checking for the release package"
3528

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

0 commit comments

Comments
 (0)