Skip to content

Commit 8a77d68

Browse files
authored
fix: Setting the ViewHierarchy attachmentType (#2036)
1 parent d81b73f commit 8a77d68

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixes
66

7+
- 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))
78
- 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))
89

910
### Dependencies

src/Sentry.Unity/ViewHierarchyEventProcessor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public ViewHierarchyEventProcessor(SentryUnityOptions sentryOptions)
3232

3333
if (_options.BeforeCaptureViewHierarchyInternal?.Invoke() is not false)
3434
{
35-
hint.AddAttachment(CaptureViewHierarchy(), "view-hierarchy.json", contentType: "application/json");
35+
hint.AddAttachment(CaptureViewHierarchy(), "view-hierarchy.json", AttachmentType.ViewHierarchy, "application/json");
3636
}
3737
else
3838
{

test/Sentry.Unity.Tests/ViewHierarchyEventProcessorTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Linq;
23
using System.Threading;
34
using NUnit.Framework;
45
using UnityEngine;
@@ -39,6 +40,7 @@ public void Process_IsMainThread_AddsViewHierarchyToHint()
3940
sut.Process(sentryEvent, hint);
4041

4142
Assert.AreEqual(1, hint.Attachments.Count);
43+
Assert.AreEqual(AttachmentType.ViewHierarchy, hint.Attachments.First().Type);
4244
}
4345

4446
[Test]

0 commit comments

Comments
 (0)