Closed bruno-garcia closed 4 days ago
Came up on Discord
Based on the error message and logic aroud, the event shouldn't be lost. Only the ViewHierarchy would be:
Based on the stack trace, something is null here:
null
https://github.com/getsentry/sentry-unity/blob/bac420f65b119bab0cf64cf6820a7ce1f183c811/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs#L82
Sentry: (Error) Failed to add attachment: view-hierarchy.json. System.NullReferenceException: Object reference not set to an instance of an object at Sentry.Unity.UnityViewHierarchyAttachmentContent+<>c.<CreateNode>b__5_0 (UnityEngine.Component e) [0x00000] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:82 at System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () [0x0002a] in <2a397996daff412691ae4781443e8e88>:0 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <2a397996daff412691ae4781443e8e88>:0 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x0000e] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:75 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateNode (System.Int32 remainingDepth, System.Int32 maxChildCount, Sentry.ViewHierarchyNode parentNode, UnityEngine.Transform transform) [0x000f2] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:96 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CreateViewHierarchy (System.Int32 maxRootGameObjectCount, System.Int32 maxChildCount, System.Int32 maxDepth) [0x0004b] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:65 at Sentry.Unity.UnityViewHierarchyAttachmentContent.CaptureViewHierarchy () [0x00016] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:39 at Sentry.Unity.UnityViewHierarchyAttachmentContent.GetStream () [0x00028] in /sentry-unity/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs:31 at Sentry.Protocol.Envelopes.Envelope.FromEvent (Sentry.SentryEvent event, Sentry.Extensibility.IDiagnosticLogger logger, System.Collections.Generic.IReadOnlyCollection`1[T] attachments, Sentry.SessionUpdate sessionUpdate) [0x0005d] in /sentry-unity/src/sentry-dotnet/src/Sentry/Protocol/Envelopes/Envelope.cs:255 UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) (at /sentry-unity/src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs:99) UnityEngine.Logger:Log (UnityEngine.LogType,string,object) Sentry.Unity.UnityLogger:Log (Sentry.SentryLevel,string,System.Exception,object[]) (at /sentry-unity/src/Sentry.Unity/UnityLogger.cs:33) Sentry.Extensibility.DiagnosticLoggerExtensions:LogIfEnabled<string> (Sentry.Extensibility.IDiagnosticLogger,Sentry.SentryLevel,System.Exception,string,string) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:509) Sentry.Extensibility.DiagnosticLoggerExtensions:LogError<string> (Sentry.Extensibility.IDiagnosticLogger,System.Exception,string,string) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:298) Sentry.Protocol.Envelopes.Envelope:FromEvent (Sentry.SentryEvent,Sentry.Extensibility.IDiagnosticLogger,System.Collections.Generic.IReadOnlyCollection`1<Sentry.SentryAttachment>,Sentry.SessionUpdate) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Protocol/Envelopes/Envelope.cs:273) Sentry.SentryClient:DoSendEvent (Sentry.SentryEvent,Sentry.SentryHint,Sentry.Scope) (at /sentry-unity/src/sentry-dotnet/src/Sentry/SentryClient.cs:368) Sentry.SentryClient:CaptureEvent (Sentry.SentryEvent,Sentry.Scope,Sentry.SentryHint) (at /sentry-unity/src/sentry-dotnet/src/Sentry/SentryClient.cs:75) Sentry.Internal.Hub:CaptureEvent (Sentry.SentryEvent,Sentry.SentryHint,Sentry.Scope) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Hub.cs:482) Sentry.Internal.Hub:CaptureEvent (Sentry.SentryEvent,Sentry.Scope,Sentry.SentryHint) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Hub.cs:452) Sentry.SentryClientExtensions:CaptureMessage (Sentry.ISentryClient,string,Sentry.SentryLevel) (at /sentry-unity/src/sentry-dotnet/src/Sentry/SentryClientExtensions.cs:33) Sentry.SentrySdk:CaptureMessage (string,Sentry.SentryLevel) (at /sentry-unity/src/sentry-dotnet/src/Sentry/SentrySdk.cs:469) Utilities.Sentry.SentryLogUtility:LogMessage (string,Sentry.SentryLevel) (at Assets/Scripts/Utilities/Sentry/SentryLogUtility.cs:80) Utilities.Sentry.SentryLogUtility:LogError (string) (at Assets/Scripts/Utilities/Sentry/SentryLogUtility.cs:39) Utilities.GlobalExceptionHandler:HandleLog (string,string,UnityEngine.LogType) (at Assets/Scripts/Utilities/GlobalExceptionHandler.cs:45) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) (at /sentry-unity/src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs:99) UnityEngine.Debug:LogError (object) Utilities.Sentry.SentryLogUtility:LogMessage (string,Sentry.SentryLevel) (at Assets/Scripts/Utilities/Sentry/SentryLogUtility.cs:73) Utilities.Sentry.SentryLogUtility:LogError (string) (at Assets/Scripts/Utilities/Sentry/SentryLogUtility.cs:39) FitCraft.Domain.Extensions.CardConfigurationExtensions:InstantiateObject (FitCraft.Domain.Models.CatalogItem,UnityEngine.Transform,string,int) (at Assets/Scripts/Domain/Extensions/CardConfigurationExtensions.cs:100) FitCraft.Presentation.Popups.RewardContentRevealPopup/<>c__DisplayClass11_0:<UpdateScrollView>b__0 (UnityEngine.GameObject) (at Assets/Scripts/Presentation/Popups/RewardContentRevealPopup.cs:132) Utilities.AddressablesUtility/<>c__DisplayClass0_0`1<UnityEngine.GameObject>:<LoadPrefab>b__0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>) (at Assets/Scripts/Utilities/AddressablesUtility.cs:27) DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>) (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/Util/DelegateList.cs:75) UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate () (at ./Library/PackageCache/com.unity.addressables@1.21.21/Runtime/ResourceManager/Util/DelayedActionManager.cs:162)
Came up on Discord
Based on the error message and logic aroud, the event shouldn't be lost. Only the ViewHierarchy would be:
Based on the stack trace, something is
null
here:https://github.com/getsentry/sentry-unity/blob/bac420f65b119bab0cf64cf6820a7ce1f183c811/src/Sentry.Unity/UnityViewHierarchyAttachmentContent.cs#L82