getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
218 stars 52 forks source link

Build fails when newer unity sentry package is installed #1896

Open joaoadpereira opened 1 week ago

joaoadpereira commented 1 week ago

Environment

windows 10

How did you install the package? (Git-URL, Assetstore) https://github.com/getsentry/unity.git#2.3.0

Which version of Unity? Unity 2020.3.23f1

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? It is happening when building to android

Steps to Reproduce

  1. What
  2. you
  3. did.

Expected Result

What you thought would happen. Update Sentry Unity package from 1.4.1 to 2.3.0. At the moment is not possible to update unity version.

Any logs or screenshots

Exception: Failed running C:\Program Files\Unity\Hub\Editor\2020.3.23f1\Editor\Data\il2cpp\build/deploy/netcoreapp3.1/UnityLinker.exe @C:/UnityProjects/glarmobileunity/Temp/StagingArea/assets/bin/Data/Managed/response.rsp

stdout:
Fatal error in Unity CIL Linker
Mono.Linker.MarkException: Error processing method: 'System.Void System.Text.Json.Nodes.JsonArray::Add(T)' in assembly: 'System.Text.Json.dll'
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Mono.Linker.Steps.MarkStep.GetMethodWithNoParameters(TypeDefinition type, String methodname)
   at Mono.Linker.Steps.MarkStep.MarkTypeWithDebuggerDisplayAttribute(TypeDefinition type, CustomAttribute attribute)
   at Mono.Linker.Steps.MarkStep.MarkTypeSpecialCustomAttributes(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Unity.Linker.Steps.UnityMarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Unity.Linker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at Unity.Linker.UnityDriver.UnityRun(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriver()
stderr:

UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.Runner.RunNetCoreProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (System.Collections.Generic.IEnumerable`1[T] args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String outputFolder, System.String& output, System.String& error, System.Collections.Generic.IEnumerable`1[T] linkXmlFiles, UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <04fd49fe433b413dbaa78a3164f6959b>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <04fd49fe433b413dbaa78a3164f6959b>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <04fd49fe433b413dbaa78a3164f6959b>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <04fd49fe433b413dbaa78a3164f6959b>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
Build:ExportAndroid(Boolean, AndroidArchitecture) (at Assets/Editor/Build.cs:41)
Assets.Editor.Android:Export(Action, Boolean) (at Assets/Editor/PlatformModels/Android.cs:16)
Assets.Editor.Exporter:PerformBuild() (at Assets/Editor/Exporter.cs:206)
Assets.Editor.Exporter:GUIButtonBuildExport() (at Assets/Editor/Exporter.cs:193)
Assets.Editor.Exporter:GUICardBuildExport() (at Assets/Editor/Exporter.cs:179)
Assets.Editor.Exporter:OnGUI() (at Assets/Editor/Exporter.cs:73)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Exception: Failed
Build.ReportSummary (UnityEditor.Build.Reporting.BuildSummary summary) (at Assets/Editor/Build.cs:56)
Build.ExportAndroid (System.Boolean developmentBuild, UnityEditor.AndroidArchitecture architectures) (at Assets/Editor/Build.cs:43)
Assets.Editor.Android.Export (System.Action callback, System.Boolean developmentBuild) (at Assets/Editor/PlatformModels/Android.cs:16)
Assets.Editor.Exporter.PerformBuild () (at Assets/Editor/Exporter.cs:206)
Assets.Editor.Exporter.GUIButtonBuildExport () (at Assets/Editor/Exporter.cs:193)
Assets.Editor.Exporter.GUICardBuildExport () (at Assets/Editor/Exporter.cs:179)
Assets.Editor.Exporter.OnGUI () (at Assets/Editor/Exporter.cs:73)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEditor.DockArea.OldOnGUI () (at <ad50112e30b445fdbf80d5814c3cbcf6>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <53902087bc8645c2b76c7b23d6928f19>:0)
bitsandfoxes commented 1 week ago

Hey @joaoadpereira, sorry to see you run into issues. Could you try the following:

  1. Uninstalling the sentry package
  2. Ignore the compiler errors in your console
  3. Install the new package version
  4. Build your app using Clean Build

We've got a know issue https://github.com/getsentry/sentry-unity/issues/1847 where the build cache does not get cleaned when updating the SDK, causing all kinds of issues like conflicting dependencies.