diff --git a/CHANGELOG.md b/CHANGELOG.md index 0813f318a..c455357a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,16 @@ ## Unreleased +### API Changes + +- The `SentrySdk.Metrics` module is deprecated and will be removed in the next major release. + Sentry will reject all metrics sent after October 7, 2024. + Learn more: https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics ([#3619](https://github.com/getsentry/sentry-dotnet/pull/3619)) + ### Fixes +- The SDK now uses the .NET SDK's `Options.FileWriteDisabled` to opt-out on any writing operations on 'unknown' platforms such as the Nintendo Switch ([1814](https://github.com/getsentry/sentry-unity/pull/1814)) +- The SDK no longer freezes the game during shutdown when targeting WebGL ([#3619](https://github.com/getsentry/sentry-dotnet/pull/3619)) - The SDK no longer passes a mangled `gpu.vendorId` to the Android native layer ([#1813](https://github.com/getsentry/sentry-unity/pull/1813)) ### Features @@ -16,6 +24,9 @@ - Bump Native SDK from v0.7.9 to v0.7.10 ([#1809](https://github.com/getsentry/sentry-unity/pull/1809)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0710) - [diff](https://github.com/getsentry/sentry-native/compare/0.7.9...0.7.10) +- Bump .NET SDK from v4.10.2 to v4.12.0 ([#1823](https://github.com/getsentry/sentry-unity/pull/1823)) + - [changelog](https://github.com/getsentry/sentry-dotnet/blob/main/CHANGELOG.md#4120) + - [diff](https://github.com/getsentry/sentry-dotnet/compare/4.10.2...4.12.0) - Bump CLI from v2.34.1 to v2.36.6 ([#1788](https://github.com/getsentry/sentry-unity/pull/1788), [#1792](https://github.com/getsentry/sentry-unity/pull/1792), [#1796](https://github.com/getsentry/sentry-unity/pull/1796), [#1810](https://github.com/getsentry/sentry-unity/pull/1810), [#1815](https://github.com/getsentry/sentry-unity/pull/1815), [#1819](https://github.com/getsentry/sentry-unity/pull/1819), [#1820](https://github.com/getsentry/sentry-unity/pull/1820), [#1822](https://github.com/getsentry/sentry-unity/pull/1822)) - [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2366) - [diff](https://github.com/getsentry/sentry-cli/compare/2.34.1...2.36.6) diff --git a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs index b86e6bee0..2a9008542 100644 --- a/src/Sentry.Unity/ScriptableSentryUnityOptions.cs +++ b/src/Sentry.Unity/ScriptableSentryUnityOptions.cs @@ -239,6 +239,8 @@ private void HandlePlatformRestrictions(SentryUnityOptions options, IApplication { if (unityInfo?.IsKnownPlatform() == false) { + options.DisableFileWrite = true; + // This is only provided on a best-effort basis for other than the explicitly supported platforms. if (options.BackgroundWorker is null) { @@ -259,13 +261,6 @@ private void HandlePlatformRestrictions(SentryUnityOptions options, IApplication options.DiagnosticLogger?.LogDebug("Platform support for automatic session tracking is unknown: disabling."); options.AutoSessionTracking = false; } - - // Requires file access - if (options.TracesSampleRate > 0.0f) - { - options.DiagnosticLogger?.LogDebug("Platform support for tracing is unknown: disabling."); - options.TracesSampleRate = null; - } } } diff --git a/src/sentry-dotnet b/src/sentry-dotnet index e3b7b3b27..69d522098 160000 --- a/src/sentry-dotnet +++ b/src/sentry-dotnet @@ -1 +1 @@ -Subproject commit e3b7b3b272ce2376a6cb258a71c5ba7388c6489d +Subproject commit 69d5220989f70e38e7a98d363ced9163038da34e diff --git a/test/Sentry.Unity.Tests/ScriptableSentryUnityOptionsTests.cs b/test/Sentry.Unity.Tests/ScriptableSentryUnityOptionsTests.cs index f16a298b2..f1210e964 100644 --- a/test/Sentry.Unity.Tests/ScriptableSentryUnityOptionsTests.cs +++ b/test/Sentry.Unity.Tests/ScriptableSentryUnityOptionsTests.cs @@ -1,7 +1,11 @@ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Reflection; using NUnit.Framework; +using Sentry.Extensibility; +using Sentry.Unity.Integrations; using Sentry.Unity.Tests.Stubs; using UnityEngine; @@ -135,6 +139,45 @@ public void ToSentryUnityOptions_UnknownPlatforms_DoesNotAccessDisk() Assert.IsFalse(options.AutoSessionTracking); } + [Test] + public void ToSentryUnityOptions_WebExceptionFilterAdded() + { + var scriptableOptions = ScriptableObject.CreateInstance(); + _fixture.UnityInfo = new TestUnityInfo(true); + + var options = scriptableOptions.ToSentryUnityOptions(false, _fixture.UnityInfo, _fixture.Application); + + var exceptionFiltersPropertyInfo = typeof(SentryOptions).GetProperty("ExceptionFilters", BindingFlags.NonPublic | BindingFlags.Instance); + var filters = exceptionFiltersPropertyInfo.GetValue(options) as List; + Assert.True(filters.OfType().Any()); + } + + [Test] + public void ToSentryUnityOptions_UnitySocketExceptionFilterAdded() + { + var scriptableOptions = ScriptableObject.CreateInstance(); + _fixture.UnityInfo = new TestUnityInfo(true); + + var options = scriptableOptions.ToSentryUnityOptions(false, _fixture.UnityInfo, _fixture.Application); + + var exceptionFiltersPropertyInfo = typeof(SentryOptions).GetProperty("ExceptionFilters", BindingFlags.NonPublic | BindingFlags.Instance); + var filters = exceptionFiltersPropertyInfo.GetValue(options) as List; + Assert.True(filters.OfType().Any()); + } + + [Test] + public void ToSentryUnityOptions_UnityBadGatewayExceptionFilterAdded() + { + var scriptableOptions = ScriptableObject.CreateInstance(); + _fixture.UnityInfo = new TestUnityInfo(true); + + var options = scriptableOptions.ToSentryUnityOptions(false, _fixture.UnityInfo, _fixture.Application); + + var exceptionFiltersPropertyInfo = typeof(SentryOptions).GetProperty("ExceptionFilters", BindingFlags.NonPublic | BindingFlags.Instance); + var filters = exceptionFiltersPropertyInfo.GetValue(options) as List; + Assert.True(filters.OfType().Any()); + } + public static void AssertOptions(SentryUnityOptions expected, SentryUnityOptions actual) { Assert.AreEqual(expected.Enabled, actual.Enabled); diff --git a/test/Sentry.Unity.Tests/UnityBadGatewayExceptionFilterTests.cs b/test/Sentry.Unity.Tests/UnityBadGatewayExceptionFilterTests.cs index b854a16d6..bfab5d235 100644 --- a/test/Sentry.Unity.Tests/UnityBadGatewayExceptionFilterTests.cs +++ b/test/Sentry.Unity.Tests/UnityBadGatewayExceptionFilterTests.cs @@ -24,19 +24,6 @@ public void Filter_FiltersBadGatewayExceptionsOfTypeException() => Assert.IsTrue(new UnityBadGatewayExceptionFilter().Filter(new Exception(UnityBadGatewayExceptionFilter.Message))); - [Test] - public void Init_WithDefaultOptions_DoesNotSendBadGatewayExceptions() - { - LogAssert.ignoreFailingMessages = true; // The TestHttpClientHandler will complain about timing out (and it should!) - - using var _ = SentryTests.InitSentrySdk(testHttpClientHandler: _testHttpClientHandler); - - SentrySdk.CaptureException(new Exception(UnityBadGatewayExceptionFilter.Message + _identifyingEventValue)); - - var createdEvent = _testHttpClientHandler.GetEvent(_identifyingEventValue, _eventReceiveTimeout); - Assert.AreEqual(string.Empty, createdEvent); - } - internal IDisposable InitSentrySdk(Action? configure = null) { SentryUnity.Init(options => diff --git a/test/Sentry.Unity.Tests/UnitySocketExceptionFilterTests.cs b/test/Sentry.Unity.Tests/UnitySocketExceptionFilterTests.cs index 3bd8445b6..acb43ffab 100644 --- a/test/Sentry.Unity.Tests/UnitySocketExceptionFilterTests.cs +++ b/test/Sentry.Unity.Tests/UnitySocketExceptionFilterTests.cs @@ -17,17 +17,4 @@ public void SetUp() => [Test] public void Filter_FiltersBadGatewayExceptionsOfTypeException() => Assert.IsTrue(new UnitySocketExceptionFilter().Filter(new System.Net.Sockets.SocketException(10049))); - - [Test] - public void Init_WithDefaultOptions_DoesNotSendFilteredSocketExceptions() - { - LogAssert.ignoreFailingMessages = true; // The TestHttpClientHandler will complain about timing out (and it should!) - - using var _ = SentryTests.InitSentrySdk(testHttpClientHandler: _testHttpClientHandler); - - SentrySdk.CaptureException(new System.Net.Sockets.SocketException(10049)); // The requested address is not valid in this context - - var createdEvent = _testHttpClientHandler.GetEvent(UnitySocketExceptionFilter.Message, _eventReceiveTimeout); - Assert.AreEqual(string.Empty, createdEvent); - } } diff --git a/test/Sentry.Unity.Tests/UnityWebExceptionFilterTests.cs b/test/Sentry.Unity.Tests/UnityWebExceptionFilterTests.cs index ae33598b6..8bf6fea44 100644 --- a/test/Sentry.Unity.Tests/UnityWebExceptionFilterTests.cs +++ b/test/Sentry.Unity.Tests/UnityWebExceptionFilterTests.cs @@ -1,6 +1,7 @@ using System; using NUnit.Framework; using Sentry.Unity.Integrations; +using UnityEngine; using UnityEngine.TestTools; namespace Sentry.Unity.Tests; @@ -17,17 +18,4 @@ public void SetUp() => [Test] public void Filter_FiltersBadGatewayExceptionsOfTypeException() => Assert.IsTrue(new UnityWebExceptionFilter().Filter(new System.Net.WebException(UnityWebExceptionFilter.Message))); - - [Test] - public void Init_WithDefaultOptions_DoesNotSendFilteredWebExceptions() - { - LogAssert.ignoreFailingMessages = true; // The TestHttpClientHandler will complain about timing out (and it should!) - - using var _ = SentryTests.InitSentrySdk(testHttpClientHandler: _testHttpClientHandler); - - SentrySdk.CaptureException(new System.Net.WebException(UnityWebExceptionFilter.Message)); - - var createdEvent = _testHttpClientHandler.GetEvent(UnityWebExceptionFilter.Message, _eventReceiveTimeout); - Assert.AreEqual(string.Empty, createdEvent); - } }