From 1cfb92d851db588dda57195f822e20da85ba29e6 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 27 Mar 2025 15:45:19 +0100 Subject: [PATCH 1/2] setting app.name --- .../Integrations/UnityScopeIntegration.cs | 1 + test/Sentry.Unity.Tests/UnityEventScopeTests.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs index 02cd0c465..5b79bad0a 100644 --- a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs +++ b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs @@ -66,6 +66,7 @@ private static void PopulateSdk(SdkVersion sdk) private void PopulateApp(App app) { + app.Name = _application.ProductName; app.StartTime = MainThreadData.StartTime; var isDebugBuild = MainThreadData.IsDebugBuild; app.BuildType = isDebugBuild is null ? null : (isDebugBuild.Value ? "debug" : "release"); diff --git a/test/Sentry.Unity.Tests/UnityEventScopeTests.cs b/test/Sentry.Unity.Tests/UnityEventScopeTests.cs index 30c827ca6..7ea1e3a64 100644 --- a/test/Sentry.Unity.Tests/UnityEventScopeTests.cs +++ b/test/Sentry.Unity.Tests/UnityEventScopeTests.cs @@ -256,6 +256,7 @@ public void DeviceUniqueIdentifierWithSendDefaultPii_IsNotNull() public void AppProtocol_Assigned() { // arrange + _testApplication = new TestApplication(productName: "TestGame"); var sut = new UnityScopeUpdater(_sentryOptions, _testApplication); var scope = new Scope(_sentryOptions); @@ -263,10 +264,26 @@ public void AppProtocol_Assigned() sut.ConfigureScope(scope); // assert + Assert.IsNotNull(scope.Contexts.App.Name); Assert.IsNotNull(scope.Contexts.App.StartTime); Assert.IsNotNull(scope.Contexts.App.BuildType); } + [Test] + public void AppProtocol_AppNameIsApplicationName() + { + // arrange + _testApplication = new TestApplication(productName: "TestGame"); + var sut = new UnityScopeUpdater(_sentryOptions, _testApplication); + var scope = new Scope(_sentryOptions); + + // act + sut.ConfigureScope(scope); + + // assert + Assert.AreEqual(scope.Contexts.App.Name, _testApplication.ProductName); + } + [Test] public void UserId_SetIfEmpty() { From 30da5ea02982fa4bb20e7e13381ee2e48b818db0 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Thu, 27 Mar 2025 16:00:02 +0100 Subject: [PATCH 2/2] Updated CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04cb9aa74..49c84dd8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- The SDK now reports the game's name as part of the app context ([2083](https://github.com/getsentry/sentry-unity/pull/2083)) + ### Dependencies - Bump Cocoa SDK from v8.45.0 to v8.48.0 ([#2063](https://github.com/getsentry/sentry-unity/pull/2063), [#2071](https://github.com/getsentry/sentry-unity/pull/2071))