Skip to content

Commit

Permalink
Merge branch 'next' into PLAT-11914-InternalClientNullRefFix
Browse files Browse the repository at this point in the history
  • Loading branch information
richardelms authored May 31, 2024
2 parents 07fc159 + 755567f commit 94c11f1
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 45 deletions.
8 changes: 1 addition & 7 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aliases:
- &2020 "2020.3.48f1"
- &2021 "2021.3.36f1"
- &2022 "2022.3.22f1"
- &2023 "2023.2.17f1"
- &2023 "2023.2.19f1"


agents:
Expand Down Expand Up @@ -186,8 +186,6 @@ steps:
- label: Run WebGL e2e tests for Unity 2020
timeout_in_minutes: 30
depends_on: "cocoa-webgl-2020-fixtures"
agents:
queue: opensource-mac-cocoa-11
env:
UNITY_VERSION: *2020
plugins:
Expand Down Expand Up @@ -221,8 +219,6 @@ steps:
- label: Run WebGL e2e tests for Unity 2022
timeout_in_minutes: 30
depends_on: 'cocoa-webgl-2022-fixtures'
agents:
queue: opensource-mac-cocoa-11
env:
UNITY_VERSION: *2022
plugins:
Expand All @@ -238,8 +234,6 @@ steps:
- label: Run WebGL e2e tests for Unity 2023
timeout_in_minutes: 30
depends_on: 'cocoa-webgl-2023-fixtures'
agents:
queue: opensource-mac-cocoa-11
env:
UNITY_VERSION: *2023
plugins:
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Changelog

### TBD
## TBD ()

### Enhancements

- Added the `Bugsnag-Integrity` header to outgoing Bugsnag requests. [#797](https://github.com/bugsnag/bugsnag-unity/pull/797)

### Bug Fixes

- Added more null reference checking to the Bugsnag client to prevent crashes when accessing the client before it has been initialised [#788](https://github.com/bugsnag/bugsnag-unity/pull/788)

## 7.7.6 (2024-05-17)

- Fixed issue where meta files for the MacOS bundle were not generated. [#802](https://github.com/bugsnag/bugsnag-unity/pull/802)

## 7.7.5 (2024-05-02)

### Bug Fixes
Expand Down
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.7.5";
var version = "7.7.6";

Task("Restore-NuGet-Packages")
.Does(() => NuGetRestore(solution));
Expand Down
4 changes: 4 additions & 0 deletions features/fixtures/maze_runner/Assets/Scripts/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public virtual void PrepareConfig(string apiKey, string host)
Configuration.DotnetScriptingRuntime = FindDotnetScriptingRuntime();
Configuration.DotnetApiCompatibility = FindDotnetApiCompatibility();
Configuration.AutoTrackSessions = false;
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public void AddSwitchConfigValues(SwitchCacheType switchCacheType, int switchCacheIndex, string switchMountName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public class CorruptedCacheFile : Scenario
public override void PrepareConfig(string apiKey, string host)
{
base.PrepareConfig(apiKey, host);
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public override void PrepareConfig(string apiKey, string host)
{
base.PrepareConfig(apiKey, host);
Configuration.MaxPersistedEvents = 3;
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ public class PersistDeviceId : Scenario
public override void PrepareConfig(string apiKey, string host)
{
base.PrepareConfig(apiKey, host);
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host)
{
base.PrepareConfig(apiKey, host);
Configuration.Context = "Error 1";
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ public override void PrepareConfig(string apiKey, string host)
{
base.PrepareConfig(apiKey, host);
Configuration.Context = "Error 2";
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public override void PrepareConfig(string apiKey, string host)

return true;
});
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

public override void Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ public override void PrepareConfig(string apiKey, string host)
{
_eventsCorrect = CheckForEvents();
base.PrepareConfig(apiKey, host);
if (Application.platform == RuntimePlatform.IPhonePlayer)
{
Configuration.EnabledErrorTypes.OOMs = false;
}
}

private bool CheckForEvents()
Expand Down
3 changes: 1 addition & 2 deletions features/ios/ios_native_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Feature: iOS Native Errors
And I wait for 2 seconds
And On Mobile I relaunch the app
And I run the game in the "StartSDKDefault" state
And I wait to receive an error
And the exception "message" equals "The app was likely terminated by the operating system while in the foreground"
And I should receive no errors

Scenario: Last Run Info
When I run the game in the "IosNativeException" state
Expand Down
10 changes: 8 additions & 2 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@

BeforeAll do
$api_key = 'a35a2a72bd230ac0aa0f52715bbdc6aa'
Maze.config.enforce_bugsnag_integrity = false

if Maze.config.os&.downcase == 'macos'
# The default macOS Crash Reporter "#{app_name} quit unexpectedly" alert grabs focus which can cause tests to flake.
# This option, which appears to have been introduced in macOS 10.11, displays a notification instead of the alert.
Expand Down Expand Up @@ -113,6 +111,14 @@
end
end

Before do |scenario|
# Detect if we're running the webgl tests
if Maze.config.farm.to_s.eql?('local')
# Allows each scenario to auto retry once due to instability in the local browser
scenario.tags << Cucumber::Core::Test::Tag.new(nil, '@retry')
end
end

After do |scenario|
next if scenario.status == :skipped

Expand Down
17 changes: 17 additions & 0 deletions src/BugsnagUnity/Delivery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using BugsnagUnity.Payload;
using UnityEngine;
using UnityEngine.Networking;
using System.Security.Cryptography;

namespace BugsnagUnity
{
Expand Down Expand Up @@ -187,6 +188,8 @@ IEnumerator PushToServer(IPayload payload)
{
req.SetRequestHeader("Content-Type", "application/json");
req.SetRequestHeader("Bugsnag-Sent-At", DateTimeOffset.Now.ToString("o", CultureInfo.InvariantCulture));
req.SetRequestHeader("Bugsnag-Integrity", "sha1 " + Hash(body));

foreach (var header in payload.Headers)
{
req.SetRequestHeader(header.Key, header.Value);
Expand Down Expand Up @@ -278,6 +281,20 @@ private byte[] PrepareEventBodySimple(IPayload payload)
return serialisedPayload;
}

private string Hash(byte[] input)
{
using (SHA1Managed sha1 = new SHA1Managed())
{
var hash = sha1.ComputeHash(input);
var sb = new StringBuilder(hash.Length * 2);
foreach (byte b in hash)
{
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
}

private bool TruncateBreadcrumbs(Dictionary<string, object> @event, int bytesToRemove)
{
var breadcrumbsList = (@event[EVENT_KEY_BREADCRUMBS] as Dictionary<string, object>[]).ToList();
Expand Down
17 changes: 13 additions & 4 deletions upm-tools/build-upm-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,22 @@ fi

VERSION=$1

if [ -z "$UNITY_VERSION" ]
if [ -z "$UNITY_UPM_VERSION" ]
then
echo "UNITY_VERSION must be set"
echo "UNITY_UPM_VERSION must be set"
exit 1
fi

UNITY_PATH="/Applications/Unity/Hub/Editor/$UNITY_VERSION/Unity.app/Contents/MacOS"
#There is a bug in some versions of unity 2020, 2021 and 2022 where macos bundles will not be imported as a single plugin file.
#In which case all sub dirs and files must have .meta files to work with UPM.
#Building the UPM package with unity 2019 ensures that the meta files are created

if [[ "$UNITY_UPM_VERSION" != *"2019"* ]]; then
echo "ERROR: UNITY_UPM_VERSION must be a version of Unity 2019. See script comments for details."
exit 1
fi

UNITY_PATH="/Applications/Unity/Hub/Editor/$UNITY_UPM_VERSION/Unity.app/Contents/MacOS"



Expand Down Expand Up @@ -72,4 +81,4 @@ sed -i '' "s/VERSION_STRING/$VERSION/g" "$PACKAGE_DIR/package.json"
sed -i '' "s/VERSION_STRING/v$VERSION/g" "$PACKAGE_DIR/README.md"


echo "complete, ready to deploy"
echo "complete, ready to deploy"

0 comments on commit 94c11f1

Please sign in to comment.