Skip to content

Commit

Permalink
Merge pull request #650 from bugsnag/next
Browse files Browse the repository at this point in the history
Release v7.2.3
  • Loading branch information
rich-bugsnag authored Oct 17, 2022
2 parents d04bff3 + 5e2865f commit 0394002
Show file tree
Hide file tree
Showing 21 changed files with 391 additions and 159 deletions.
10 changes: 10 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ steps:
key: 'cocoa-webgl-2018-fixtures'
depends_on: 'build-artifacts'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2018.4.36f1"
# Python2 needed for WebGL to build
EMSDK_PYTHON: "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
plugins:
artifacts#v1.5.0:
download:
Expand All @@ -31,7 +34,10 @@ steps:
key: 'cocoa-webgl-2019-fixtures'
depends_on: 'build-artifacts'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2019.4.35f1"
# Python2 needed for WebGL to build
EMSDK_PYTHON: "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
plugins:
artifacts#v1.5.0:
download:
Expand All @@ -52,6 +58,7 @@ steps:
key: 'cocoa-webgl-2021-fixtures'
depends_on: 'build-artifacts'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2021.3.3f1"
plugins:
artifacts#v1.5.0:
Expand Down Expand Up @@ -391,6 +398,7 @@ steps:
agents:
queue: macos-12-arm-unity
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2018.4.36f1"
plugins:
artifacts#v1.5.0:
Expand Down Expand Up @@ -436,6 +444,7 @@ steps:
agents:
queue: macos-12-arm-unity
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2019.4.35f1"
plugins:
artifacts#v1.5.0:
Expand Down Expand Up @@ -481,6 +490,7 @@ steps:
agents:
queue: macos-12-arm-unity
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2021.3.3f1"
plugins:
artifacts#v1.5.0:
Expand Down
5 changes: 5 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ steps:
timeout_in_minutes: 30
key: 'build-artifacts'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2018.4.36f1"
commands:
- bundle install
Expand Down Expand Up @@ -48,7 +49,10 @@ steps:
key: 'cocoa-webgl-2020-fixtures'
depends_on: 'build-artifacts'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2020.3.32f1"
# Python2 needed for WebGL to build
EMSDK_PYTHON: "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
plugins:
artifacts#v1.5.0:
download:
Expand Down Expand Up @@ -233,6 +237,7 @@ steps:
key: 'build-ios-fixture-2020'
depends_on: 'generate-fixture-project-2020'
env:
DEVELOPER_DIR: "/Applications/Xcode13.4.app"
UNITY_VERSION: "2020.3.32f1"
plugins:
artifacts#v1.5.0:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 7.3.0 (2022-10-17)

### Enhancements

* Added Nintendo Switch specific configuration values to the Bugsnag configuration tool [#626](https://github.com/bugsnag/bugsnag-unity/pull/626)

### Bug fixes

* Removed `device.freeDisk` and `device.freeMemory` metadata from events sent in [UWP](https://docs.unity3d.com/Manual/windowsstore-buildsettings.html) builds as accessing the data can cause an exception. [#648](https://github.com/bugsnag/bugsnag-unity/pull/648)

### Dependency updates

- Update bugsnag-cocoa from v6.22.3 to [v6.24.0](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6240-2022-10-05)

## 7.2.0 (2022-09-12)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion bugsnag-cocoa
Submodule bugsnag-cocoa updated 142 files
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.2.0";
var version = "7.3.0";

Task("Restore-NuGet-Packages")
.Does(() => NuGetRestore(solution));
Expand Down
24 changes: 24 additions & 0 deletions features/desktop/switch.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Switch Specific Tests


@switch_only
Scenario: SwitchCacheType set to None
When I run the game in the "PersistEvent" state
And I wait for 5 seconds
And I close the Unity app
And I run the game in the "SwitchCacheNone" 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 exception "message" equals "SwitchCacheNone"
And I discard the oldest error
Then I should receive no requests

@switch_only
Scenario: Max Cache Size
When I run the game in the "MaxSwitchCacheSize" state
And I wait for 10 seconds
And I close the Unity app
And I run the game in the "(noop)" state
And I wait to receive 1 errors
And the exception "message" equals "LARGE PAYLOAD 2"

13 changes: 12 additions & 1 deletion features/desktop/unhandled_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Feature: Reporting unhandled events
And the event "device.runtimeVersions.dotnetApiCompatibility" is not null
And custom metadata is included in the event
And the stack frame methods should match:
| Main+<DoAsyncTest>d__51.MoveNext() | Main+<DoAsyncTest>d__49.MoveNext() | Main.DoAsyncTest() |
| Main+<DoAsyncTest>d__54.MoveNext() | Main+<DoAsyncTest>d__52.MoveNext() | Main.DoAsyncTest() |

Scenario: Session is present in exception called directly after start
When I run the game in the "ExceptionWithSessionAfterStart" state
Expand All @@ -48,6 +48,17 @@ Feature: Reporting unhandled events
And the exception "message" equals "ExceptionWithSessionAfterStart"
And the event "session" is not null

@switch_only
Scenario: Switch Metadata
When I run the game in the "UncaughtException" 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 exception "errorClass" equals "ExecutionEngineException"
And the event "app.type" equals "nintendo-switch"
And the event "device.osName" equals "Nintendo Switch"
And the event "device.model" equals "Switch"
And the event "device.manufacturer" equals "Nintendo"

@windows_only
Scenario: Windows device and app data
When I run the game in the "UncaughtException" state
Expand Down
122 changes: 112 additions & 10 deletions features/fixtures/maze_runner/Assets/Scripts/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ public class Main : MonoBehaviour

#endif

#if UNITY_SWITCH

[DllImport("__Internal")]
private static extern int bugsnag_getArgsCount();

[DllImport("__Internal")]
private static extern string bugsnag_getArg(int index);

private SwitchCacheType _switchCacheType = SwitchCacheType.R;
private int _switchCacheIndex = 0;
private string _switchCacheMountName = "BugsnagCache";
#endif

private const string API_KEY = "a35a2a72bd230ac0aa0f52715bbdc6aa";
private Dictionary<string, string> _webGlArguments;

Expand All @@ -45,28 +58,82 @@ public class Main : MonoBehaviour
public void Start()
{
Debug.Log("Maze Runner app started");

// Detemine the MAze Runner endpoint based on platform
// Determine the Maze Runner endpoint based on platform
#if UNITY_STANDALONE || UNITY_WEBGL
_mazeHost = "http://localhost:9339";
#elif UNITY_ANDROID || UNITY_IOS
return;
#elif UNITY_SWITCH
_mazeHost = "http://UPDATE_ME:9339";
GetSwitchArguments();
#else
_mazeHost = "http://bs-local.com:9339";
#endif


#if UNITY_ANDROID || UNITY_IOS
return;
#endif

#if UNITY_STANDALONE_OSX
PreventCrashPopups();
#endif

InvokeRepeating("DoRunNextMazeCommand",0,1);
}

// example command: RunOnTarget.exe 0x01004B9000490000 --no-wait -- --mazeIp 192.168.0.whatever --cacheType i --cacheIndex 3 --cacheMountName BugsnagCache
private void GetSwitchArguments()
{
#if UNITY_SWITCH
int count = bugsnag_getArgsCount();
Debug.Log("args count: " + count);

for (int i = 0; i < count; i++)
{
var arg = bugsnag_getArg(i);
if (!arg.Contains("--"))
{
Debug.Log("Ignoring arg: " + arg);
continue;
}
Debug.Log("CHECKING ARG: " + arg);
switch (arg)
{
case "--mazeIp":
var ip = bugsnag_getArg(i + 1);
_mazeHost = "http://" + ip + ":9339";
Debug.Log("SET MAZE HOST TO: " + _mazeHost);
break;

case "--cacheType":
var cacheType = bugsnag_getArg(i + 1);
switch (cacheType)
{
case "r":
_switchCacheType = SwitchCacheType.R;
break;
case "i":
_switchCacheType = SwitchCacheType.I;
break;
case "n":
_switchCacheType = SwitchCacheType.None;
break;
default:
var msg = ("Unknown cacheType option: " + cacheType);
throw new Exception(msg);
}
Debug.Log("Switch Cache Type set to: " + _switchCacheType);
break;

case "--cacheIndex":
_switchCacheIndex = int.Parse(bugsnag_getArg(i + 1));
Debug.Log("Switch cache index set to: " + _switchCacheIndex);
break;

case "--cacheMountName":
_switchCacheMountName = bugsnag_getArg(i + 1);
Debug.Log("Switch cache mount name set to: " + _switchCacheMountName);
break;
}
}
#endif
}

private void DoRunNextMazeCommand()
{
StartCoroutine(RunNextMazeCommand());
Expand Down Expand Up @@ -160,11 +227,16 @@ Configuration PrepareConfig(string scenario)
var config = new Configuration(API_KEY);
config.Endpoints = new EndpointConfiguration(_mazeHost + "/notify", _mazeHost + "/sessions");
config.AutoTrackSessions = scenario.Contains("AutoSession");

config.ScriptingBackend = FindScriptingBackend();
config.DotnetScriptingRuntime = FindDotnetScriptingRuntime();
config.DotnetApiCompatibility = FindDotnetApiCompatibility();

#if UNITY_SWITCH
config.SwitchCacheIndex = _switchCacheIndex;
config.SwitchCacheType = _switchCacheType;
config.SwitchCacheMountName = _switchCacheMountName;
#endif

PrepareConfigForScenario(config, scenario);
return config;
}
Expand Down Expand Up @@ -193,11 +265,19 @@ private void StartBugsnag(string scenario)
Bugsnag.ClearMetadata("init");
Bugsnag.ClearMetadata("test", "test2");
}

void PrepareConfigForScenario(Configuration config, string scenario)
{
switch (scenario)
{
case "MaxSwitchCacheSize":
config.SwitchCacheMaxSize = 2097155;
config.Endpoints = new EndpointConfiguration("https://notify.def-not-bugsnag.com", "https://notify.def-not-bugsnag.com");
config.AutoTrackSessions = false;
break;
case "SwitchCacheNone":
config.SwitchCacheType = SwitchCacheType.None;
break;
case "ExceptionWithSessionAfterStart":
config.AutoTrackSessions = true;
break;
Expand Down Expand Up @@ -493,6 +573,11 @@ void RunScenario(string scenario)
{
switch (scenario)
{
case "MaxSwitchCacheSize":
StartCoroutine(DoMaxSwitchCacheTest());
break;
case "SwitchCacheNone":
throw new Exception("SwitchCacheNone");
case "AsyncException":
DoAsyncTest();
break;
Expand Down Expand Up @@ -750,7 +835,24 @@ void RunScenario(string scenario)
}
}

private IEnumerator DoMaxSwitchCacheTest()
{
CacheLargePayload(1);
yield return new WaitForSeconds(1);
CacheLargePayload(2);
}

private void CacheLargePayload(int index)
{
Bugsnag.Notify(new System.Exception("LARGE PAYLOAD " + index), report =>
{
for (int i = 0; i < 100000; i++)
{
report.AddMetadata("test", "test" + i, "test");
}
return true;
});
}
private void DoInnerException()
{
throw new Exception("Outer",new Exception("Inner"));
Expand Down
21 changes: 16 additions & 5 deletions features/steps/unity_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def execute_command(action, scenario_name = '')
execute_command('clear_cache')

when 'switch'

`ControlTarget.exe launch-application #{Maze.config.app}`

switch_run_on_target
execute_command('clear_cache')

else
Expand Down Expand Up @@ -90,8 +88,7 @@ def execute_command(action, scenario_name = '')

when 'switch'

`ControlTarget.exe launch-application #{Maze.config.app}`

switch_run_on_target
execute_command('run_scenario', state)

else
Expand Down Expand Up @@ -356,3 +353,17 @@ def click_if_present(element)
# Ignore Appium errors (e.g. during an ANR)
return false
end

def switch_run_on_target
# Maze IP must always be provided
maze_ip_arg = "--mazeIp #{ENV['SWITCH_MAZE_IP']}"

# Other args are optional
cache_type_arg = $switch_cache_type ? "--cacheType #{$switch_cache_type}" : ''
cache_index_arg = $switch_cache_index ? "--cacheIndex #{$switch_cache_index}" : ''
cache_mount_name_arg = $switch_cache_mount_name ? "--cacheMountName #{$switch_cache_mount_name}" : ''

command = "RunOnTarget.exe #{Maze.config.app} --no-wait -- #{maze_ip_arg} #{cache_type_arg} #{cache_index_arg} " \
"#{cache_mount_name_arg}"
Maze::Runner.run_command(command)
end
Loading

0 comments on commit 0394002

Please sign in to comment.