Skip to content

Commit 9afeba9

Browse files
authored
Merge pull request #719 from bugsnag/next
Release v7.6.1
2 parents bc94332 + ee29283 commit 9afeba9

File tree

20 files changed

+172
-32
lines changed

20 files changed

+172
-32
lines changed

.buildkite/pipeline.full.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ steps:
200200
- Bugsnag.unitypackage
201201
upload:
202202
- features/fixtures/maze_runner/mazerunner_2018.4.36f1.apk
203-
- features/fixtures/unity.log
203+
- features/fixtures/build_android_apk.log
204204
commands:
205205
- rake test:android:build
206206
retry:
@@ -220,7 +220,7 @@ steps:
220220
- Bugsnag.unitypackage
221221
upload:
222222
- features/fixtures/maze_runner/mazerunner_2019.4.35f1.apk
223-
- features/fixtures/unity.log
223+
- features/fixtures/build_android_apk.log
224224
commands:
225225
- rake test:android:build
226226
retry:
@@ -240,7 +240,7 @@ steps:
240240
- Bugsnag.unitypackage
241241
upload:
242242
- features/fixtures/maze_runner/mazerunner_2021.3.13f1.apk
243-
- features/fixtures/unity.log
243+
- features/fixtures/build_android_apk.log
244244
commands:
245245
- rake test:android:build
246246
retry:

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ steps:
127127
- Bugsnag.unitypackage
128128
upload:
129129
- features/fixtures/maze_runner/mazerunner_2020.3.32f1.apk
130-
- features/fixtures/unity.log
130+
- features/fixtures/build_android_apk.log
131131
commands:
132132
- rake test:android:build
133133
retry:

CHANGELOG.md

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

3+
## 7.6.1 (2023-06-13)
4+
5+
## Bug Fixes
6+
7+
- Prevent callback to Unity from native layers for session and event callbacks if not used to avoid potential ANRs and improve performance. [#717](https://github.com/bugsnag/bugsnag-unity/pull/717)
8+
39
## 7.6.0 (2023-05-25)
410

511
- 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)

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.6.0";
8+
var version = "7.6.1";
99

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

features/csharp/csharp_events.feature

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feature: csharp events
1212
And the event "unhandled" is false
1313
And custom metadata is included in the event
1414
And the stack frame methods should match:
15-
| NotifySmokeTest.Run() | Main+<RunNextMazeCommand>d__7.MoveNext() |
15+
| NotifySmokeTest.Run() | Main+<RunNextMazeCommand>d__8.MoveNext() |
1616
And expected device metadata is included in the event
1717
And expected app metadata is included in the event
1818

@@ -26,7 +26,7 @@ Feature: csharp events
2626
And custom metadata is included in the event
2727
And the stack frame methods should match:
2828
| UncaughtExceptionSmokeTest.Run() | |
29-
| ScenarioRunner.RunScenario(System.String scenarioName, System.String apiKey, System.String host) | Main+<RunNextMazeCommand>d__7.MoveNext() |
29+
| ScenarioRunner.RunScenario(System.String scenarioName, System.String apiKey, System.String host) | Main+<RunNextMazeCommand>d__8.MoveNext() |
3030
And expected device metadata is included in the event
3131
And expected app metadata is included in the event
3232

@@ -39,7 +39,7 @@ Feature: csharp events
3939
And the event "unhandled" is false
4040
And custom metadata is included in the event
4141
And the stack frame methods should match:
42-
| DebugLogExceptionSmokeTest:Run() | DebugLogExceptionSmokeTest.Run() | <RunNextMazeCommand>d__7:MoveNext() | UnityEngine.SetupCoroutine.InvokeMoveNext(IEnumerator enumerator, IntPtr returnValueAddress) |
42+
| DebugLogExceptionSmokeTest:Run() | DebugLogExceptionSmokeTest.Run() | <RunNextMazeCommand>d__8:MoveNext() | UnityEngine.SetupCoroutine.InvokeMoveNext(IEnumerator enumerator, IntPtr returnValueAddress) |
4343
| ScenarioRunner:RunScenario(String, String, String) | ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) | UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) | UnityEngine.SetupCoroutine.InvokeMoveNext(IEnumerator enumerator, IntPtr returnValueAddress) |
4444
And expected device metadata is included in the event
4545
And expected app metadata is included in the event
@@ -53,7 +53,7 @@ Feature: csharp events
5353
And the event "unhandled" is false
5454
And custom metadata is included in the event
5555
And the stack frame methods should match:
56-
| DebugLogErrorSmokeTest:Run() | DebugLogErrorSmokeTest.Run() | <RunNextMazeCommand>d__7:MoveNext() | |
56+
| DebugLogErrorSmokeTest:Run() | DebugLogErrorSmokeTest.Run() | <RunNextMazeCommand>d__8:MoveNext() | |
5757
| ScenarioRunner:RunScenario(String, String, String) | ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) | ScenarioRunner:RunScenario(string,string,string) | UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) |
5858
And expected device metadata is included in the event
5959
And expected app metadata is included in the event
@@ -67,7 +67,7 @@ Feature: csharp events
6767
And the event "unhandled" is false
6868
And custom metadata is included in the event
6969
And the stack frame methods should match:
70-
| DebugLogWarningSmokeTest:Run() | DebugLogWarningSmokeTest.Run() | <RunNextMazeCommand>d__7:MoveNext() | |
70+
| DebugLogWarningSmokeTest:Run() | DebugLogWarningSmokeTest.Run() | <RunNextMazeCommand>d__8:MoveNext() | |
7171
| ScenarioRunner:RunScenario(String, String, String) | ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) | ScenarioRunner:RunScenario(string,string,string) | UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) |
7272
And expected device metadata is included in the event
7373
And expected app metadata is included in the event
@@ -81,7 +81,7 @@ Feature: csharp events
8181
And the event "unhandled" is false
8282
And custom metadata is included in the event
8383
And the stack frame methods should match:
84-
| DebugLogSmokeTest:Run() | DebugLogSmokeTest.Run() | <RunNextMazeCommand>d__7:MoveNext() | |
84+
| DebugLogSmokeTest:Run() | DebugLogSmokeTest.Run() | <RunNextMazeCommand>d__8:MoveNext() | |
8585
| ScenarioRunner:RunScenario(String, String, String) | ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) | ScenarioRunner:RunScenario(string,string,string) | UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) |
8686
And expected device metadata is included in the event
8787
And expected app metadata is included in the event
@@ -95,7 +95,7 @@ Feature: csharp events
9595
And the event "unhandled" is false
9696
And custom metadata is included in the event
9797
And the stack frame methods should match:
98-
| DebugLogAssertSmokeTest:Run() | DebugLogAssertSmokeTest.Run() | <RunNextMazeCommand>d__7:MoveNext() | |
98+
| DebugLogAssertSmokeTest:Run() | DebugLogAssertSmokeTest.Run() | <RunNextMazeCommand>d__8:MoveNext() | |
9999
| ScenarioRunner:RunScenario(String, String, String) | ScenarioRunner.RunScenario(string scenarioName, string apiKey, string host) | ScenarioRunner:RunScenario(string,string,string) | UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr) |
100100
And expected device metadata is included in the event
101101
And expected app metadata is included in the event
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using UnityEngine;
5+
6+
public class Logger : MonoBehaviour
7+
{
8+
9+
const string LOG_PREFIX = "BUGSNAG_MAZERUNNER_LOG : ";
10+
11+
const string LOG_FILE_NAME = "mazerunner-unity.log";
12+
13+
private static string _currentLog;
14+
15+
public static void I(string msg)
16+
{
17+
Debug.Log(LOG_PREFIX + msg);
18+
_currentLog = msg + "\n";
19+
WriteLogFile();
20+
}
21+
22+
private static void WriteLogFile()
23+
{
24+
var path = Path.Combine(Application.persistentDataPath, LOG_FILE_NAME);
25+
File.WriteAllText(path, _currentLog);
26+
}
27+
28+
}

features/fixtures/maze_runner/Assets/Scripts/Logger.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

features/fixtures/maze_runner/Assets/Scripts/Main.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ public class Main : MonoBehaviour
3636
private const string API_KEY = "a35a2a72bd230ac0aa0f52715bbdc6aa";
3737
private string _mazeHost;
3838

39+
private const int MAX_CONFIG_GET_TRIES = 15;
40+
3941
public ScenarioRunner ScenarioRunner;
4042

4143
public IEnumerator Start()
4244
{
43-
Debug.Log("Maze Runner app started");
45+
Log("Maze Runner app started");
4446

4547
yield return GetFixtureConfig();
4648

@@ -56,28 +58,29 @@ private IEnumerator GetFixtureConfig()
5658
Application.platform == RuntimePlatform.IPhonePlayer)
5759
{
5860
var numTries = 0;
59-
while (numTries < 5)
61+
while (numTries < MAX_CONFIG_GET_TRIES)
6062
{
6163
var configPath = Application.persistentDataPath + _fixtureConfigFileName;
6264
if (File.Exists(configPath))
6365
{
6466
var configJson = File.ReadAllText(configPath);
65-
Debug.Log("Mazerunner got fixture config json: " + configJson);
67+
Log("Mazerunner got fixture config json: " + configJson);
6668
var config = JsonUtility.FromJson<FixtureConfig>(configJson);
6769
_mazeHost = "http://" + config.maze_address;
6870
break;
6971
}
7072
else
7173
{
72-
Debug.Log("Mazerunner no fixture config found at path: " + configPath);
7374
numTries++;
75+
Log(string.Format("Maze Runner did not find the config file at path {0} try number {1}", configPath, numTries));
7476
yield return new WaitForSeconds(1);
7577
}
7678
}
7779
}
7880

7981
if (string.IsNullOrEmpty(_mazeHost))
8082
{
83+
Log("Host not set from config file, using hard coded");
8184
_mazeHost = "http://localhost:9339";
8285

8386
if (Application.platform == RuntimePlatform.IPhonePlayer ||
@@ -86,7 +89,7 @@ private IEnumerator GetFixtureConfig()
8689
_mazeHost = "http://bs-local.com:9339";
8790
}
8891
}
89-
Debug.Log("Mazerunner host set to: " + _mazeHost);
92+
Log("Mazerunner host set to: " + _mazeHost);
9093
}
9194

9295
private void DoRunNextMazeCommand()
@@ -97,7 +100,7 @@ private void DoRunNextMazeCommand()
97100
IEnumerator RunNextMazeCommand()
98101
{
99102
var url = _mazeHost + "/command";
100-
Console.WriteLine("RunNextMazeCommand called, requesting command from: {0}", url);
103+
Log("Requesting maze command from: " + url);
101104
using (UnityWebRequest request = UnityWebRequest.Get(url))
102105
{
103106
yield return request.SendWebRequest();
@@ -109,23 +112,23 @@ IEnumerator RunNextMazeCommand()
109112
!request.isNetworkError;
110113
#endif
111114

112-
Console.WriteLine("result is " + result);
115+
Log("result is " + result);
113116
if (result)
114117
{
115118
var response = request.downloadHandler?.text;
116-
Console.WriteLine("Raw response: " + response);
119+
Log("Raw response: " + response);
117120
if (response == null || response == "null" || response == "No commands to provide")
118121
{
119-
Console.WriteLine("No Maze Runner command to process at present");
122+
Log("No Maze Runner command to process at present");
120123
}
121124
else
122125
{
123126
var command = JsonUtility.FromJson<Command>(response);
124127
if (command != null)
125128
{
126-
Console.WriteLine("Received Maze Runner command:");
127-
Console.WriteLine("Action: " + command.action);
128-
Console.WriteLine("Scenario: " + command.scenarioName);
129+
Log("Received Maze Runner command:");
130+
Log("Action: " + command.action);
131+
Log("Scenario: " + command.scenarioName);
129132

130133
if ("clear_cache".Equals(command.action))
131134
{
@@ -178,6 +181,11 @@ public static void ClearIOSData()
178181
#endif
179182
}
180183

184+
private static void Log(string msg)
185+
{
186+
Logger.I(msg);
187+
}
188+
181189
}
182190

183191

features/fixtures/maze_runner/Assets/Scripts/Scenarios/Android/AndroidBackgroundJVMSmokeTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public override void PrepareConfig(string apiKey, string host)
1010
base.PrepareConfig(apiKey, host);
1111
Configuration.SetUser("1", "2", "3");
1212
Configuration.ProjectPackages = new string[] { "test.test.test" };
13+
Configuration.AddOnSession((s) => { return true; });
1314
}
1415

1516
public override void Run()

features/fixtures/maze_runner/Assets/Scripts/Scenarios/iOS/IosNativeException.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public class IosNativeException : Scenario
55
public override void PrepareConfig(string apiKey, string host)
66
{
77
base.PrepareConfig(apiKey, host);
8+
Configuration.AddOnSession((s) => { return true; });
89
}
910

1011
public override void Run()

0 commit comments

Comments
 (0)