Skip to content

Stacktrace does not match Unity log when switching from 'Script Only' to 'Full' #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bitsandfoxes opened this issue Jan 18, 2022 · 4 comments
Labels
Bug Something isn't working Good First Issue Good for newcomers Mono

Comments

@bitsandfoxes
Copy link
Contributor

Came from: https://discord.com/channels/621778831602221064/621783582628642822/930258591452123147

  1. Create new Unity 3D project with Unity 2021.2.4f1.
  2. Import Sentry Unity 0.9.2 package via Git URL.
  3. Add High Definition RP through Unity Package Manager.
  4. Duplicate "Directional Light" once in the default "SampleScene" so that there are now two.
  5. For unrelated reasons, be forced to restart Unity once or twice and have it crash on you twice. (this happened to me, your mileage may vary)
  6. Set a valid DSN in Sentry options window.
  7. Go to "Player Settings" and in the "Stack Trace" options checkboxes, switch it from "ScriptOnly" to "Full" for errors and exceptions.
  8. Run the game in editor and see the "Cascade Shadow atlasing has failed, only one directional light can cast shadows at a time" error in Console output.
  9. View this issue in Sentry dashboard, and see that the call stack only has the addresses, but the callstack seen in the editor's console output had much more information.

unity-error-sentry-repro (1).zip

@bitsandfoxes bitsandfoxes moved this to Needs Discussion in [DEPRECATED] Mobile SDKs Jan 18, 2022
@bitsandfoxes bitsandfoxes added the Bug Something isn't working label Jan 18, 2022
@bitsandfoxes
Copy link
Contributor Author

Some context information:
When switching to 'Full' Unity provides additional string as stacktrace that we do not yet support by parsing.

Screenshot 2022-01-18 at 20 37 41

Cascade Shadow atlasing has failed, only one directional light can cast shadows at a time
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [LightLoop.cs:1612] UnityEngine.Rendering.HighDefinition.HDRenderPipeline:PrepareGPULightdata (UnityEngine.Rendering.CommandBuffer,UnityEngine.Rendering.HighDefinition.HDCamera,UnityEngine.Rendering.CullingResults)
 #5  (Mono JIT Code) [LightLoop.cs:1878] UnityEngine.Rendering.HighDefinition.HDRenderPipeline:PrepareLightsForGPU (UnityEngine.Rendering.CommandBuffer,UnityEngine.Rendering.HighDefinition.HDCamera,UnityEngine.Rendering.CullingResults,UnityEngine.Rendering.HighDefinition.HDProbeCullingResults,UnityEngine.Rendering.HighDefinition.LocalVolumetricFogList,UnityEngine.Rendering.HighDefinition.DebugDisplaySettings,UnityEngine.Rendering.HighDefinition.AOVRequestData)
 #6  (Mono JIT Code) [HDRenderPipeline.cs:2046] UnityEngine.Rendering.HighDefinition.HDRenderPipeline:ExecuteRenderRequest (UnityEngine.Rendering.HighDefinition.HDRenderPipeline/RenderRequest,UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering.CommandBuffer,UnityEngine.Rendering.HighDefinition.AOVRequestData)
 #7  (Mono JIT Code) [HDRenderPipeline.cs:1856] UnityEngine.Rendering.HighDefinition.HDRenderPipeline:Render (UnityEngine.Rendering.ScriptableRenderContext,System.Collections.Generic.List`1<UnityEngine.Camera>)
 #8  (Mono JIT Code) [RenderPipeline.cs:52] UnityEngine.Rendering.RenderPipeline:InternalRender (UnityEngine.Rendering.ScriptableRenderContext,System.Collections.Generic.List`1<UnityEngine.Camera>)
 #9  (Mono JIT Code) [RenderPipelineManager.cs:115] UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset,intptr,System.Collections.Generic.List`1<UnityEngine.Camera/RenderRequest>,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)
 #10  (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_intptr_object_AtomicSafetyHandle (object,intptr,intptr,intptr)
 #11 mono_jit_runtime_invoke
 #12 do_runtime_invoke
 #13 mono_runtime_invoke
 #14 scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
 #15 ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
 #16 ScriptableRenderContext::ExtractAndExecuteRenderPipeline(dynamic_array<Camera*, 0ul> const&, void (*)(SceneNode const*, AABB const*, IndexList&, SceneCullingParameters const*), void*, ScriptingObjectPtr)
 #17 Camera::ExecuteCustomRenderPipeline(Camera::EditorDrawingMode, DrawGridParameters const*, Camera::RenderFlag)
 #18 Camera::RenderEditorCamera(Camera::EditorDrawingMode, DrawGridParameters const*, CullResults*, Camera::RenderFlag, int, bool, bool, core::hash_set<GameObject*, core::hash<GameObject*>, std::__1::equal_to<GameObject*> >*)
 #19 Camera::RenderEditorCamera(Camera::EditorDrawingMode, DrawGridParameters const*, bool, bool, core::hash_set<GameObject*, core::hash<GameObject*>, std::__1::equal_to<GameObject*> >*)
 #20 Handles_CUSTOM_Internal_DrawCameraWithGrid(ScriptingBackendNativeObjectPtrOpaque*, Camera::EditorDrawingMode, DrawGridParameters&, unsigned char, unsigned char)
 #21  (Mono JIT Code) (wrapper managed-to-native) UnityEditor.Handles:Internal_DrawCameraWithGrid (UnityEngine.Camera,UnityEditor.DrawCameraMode,UnityEditor.DrawGridParameters&,bool,bool)

@bruno-garcia
Copy link
Member

bruno-garcia commented Jan 18, 2022

Mono isn't the main use case but on IL2CPP I'm curious what these would look like.
That said, makes sense to improve parsing so that we show all frames with the most data relevant.

We have some unit tests for the current parsing code:

public void ToSentryException_ParsingTestCases(

Code for parsing this is here: https://github.com/getsentry/sentry-unity/blob/main/src/Sentry.Unity/UnityLogException.cs
This is a good first issue for someone who wants to contribute to the SDK, we're happy to help review the PR.

Worth noting Sentry stacktrace has a platform field that can be set to native in this case. This should show 'mixed-stacktraces'. @lucas-zimerman did something like this of Xamarin.iOS IIRC.

@bitsandfoxes
Copy link
Contributor Author

Closed by #731

Repository owner moved this from Backlog to Done in [DEPRECATED] Mobile SDKs May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Good First Issue Good for newcomers Mono
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants