Skip to content

Commit

Permalink
fix: Setting the ViewHierarchy attachmentType (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes authored Feb 25, 2025
1 parent d81b73f commit 8a77d68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixes

- Resolved an issue where the SDK would not properly annotate the ViewHierarchy's `AttachmentType`. This would cause it to not render properly on the issues-page on Sentry ([#2036](https://github.com/getsentry/sentry-unity/pull/2036))
- The SDK now ensures that the correct version of the Android SDK gets used during the build. This prevents dependency conflicts and no longer requires "clean" builds to resolve ([#2031](https://github.com/getsentry/sentry-unity/pull/2031))

### Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.Unity/ViewHierarchyEventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ViewHierarchyEventProcessor(SentryUnityOptions sentryOptions)

if (_options.BeforeCaptureViewHierarchyInternal?.Invoke() is not false)
{
hint.AddAttachment(CaptureViewHierarchy(), "view-hierarchy.json", contentType: "application/json");
hint.AddAttachment(CaptureViewHierarchy(), "view-hierarchy.json", AttachmentType.ViewHierarchy, "application/json");
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions test/Sentry.Unity.Tests/ViewHierarchyEventProcessorTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using UnityEngine;
Expand Down Expand Up @@ -39,6 +40,7 @@ public void Process_IsMainThread_AddsViewHierarchyToHint()
sut.Process(sentryEvent, hint);

Assert.AreEqual(1, hint.Attachments.Count);
Assert.AreEqual(AttachmentType.ViewHierarchy, hint.Attachments.First().Type);
}

[Test]
Expand Down

0 comments on commit 8a77d68

Please sign in to comment.