Unity 6 - Line numbers

オープン
#2,025 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
csharp, unity

調査の方向性

src/Sentry.Unity/Il2CppEventProcessor.cs と src/Sentry.Unity/Integrations/UnityApplicationLoggingIntegration.cs から始め、ここで説明されている Unity 6 の例外スタックトレースの挙動を既存の処理フローと比較してください。完了とは、Unity 6 のスタックトレースがメソッド、ファイル、行の情報を保持し、新しいデータが利用可能な場合に SDK が不要な IL2CPP 処理を回避することを意味します。

索引モデルが issue の本文から書いたものです。

説明

Errors Improvement Unity

Context

To provide line numbers we're added the IL2CppEventProcessor. The main responsibility of this processor is to call into the IL2CPP backend, get the native stacktrace and match it with the managed one and fix instruction addresses. With those Sentry is able to serverside symbolicate the issue.

Unity 6

What's New

Unity 6 introduced a new option to the IL2CPP configuration and exception can now include method name, file name, and line number.

Image

Triggering a NullReferenceException and logging is via exception.toString() results in the following logs

System.NullReferenceException: Object reference not set to an instance of an object.
  at BugFarmButtons.ThrowNull () [0x00000] in /Users/bitfox/Workspace/sentry-unity/samples/unity-of-bugs/Assets/Scripts/BugFarmButtons.cs:24 
  at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Collections.Generic.Enumerable.EnumerableIList`1[T]..ctor (System.Collections.Generic.IList`1[T] list) [0x00000] in /Users/bitfox/Workspace/sentry-unity/src/sentry-dotnet/modules/Ben.Demystifier/src/Ben.Demystifier/Enumerable/EnumerableIList.cs:15 
  at UnityEngine.EventSystems.StandaloneInputModule.ReleaseMouse (UnityEngine.EventSystems.PointerEventData pointerEvent, UnityEngine.GameObject currentOverGo) [0x00000] in ./Library/PackageCache/com.unity.ugui@03407c6d8751/Runtime/UGUI/EventSystem/InputModules/StandaloneInputModule.cs:192 
  at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent (System.Int32 id) [0x00000] in ./Library/PackageCache/com.unity.ugui@03407c6d8751/Runtime/UGUI/EventSystem/InputModules/StandaloneInputModule.cs:554 
  at UnityEngine.EventSystems.StandaloneInputModule.ProcessMouseEvent () [0x00000] in ./Library/PackageCache/com.unity.ugui@03407c6d8751/Runtime/UGUI/EventSystem/InputModules/StandaloneInputModule.cs:534 
  at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in ./Library/PackageCache/com.unity.ugui@03407c6d8751/Runtime/UGUI/EventSystem/InputModules/StandaloneInputModule.cs:282 

What does this enable
Line numbers for Debug.LogError

Events captured via Debug.LogError automatically contain line numbers as these are parsed from the stringified stacktrace in the ApplicationLoggingIntegration.

Image

Line numbers for unhandled exceptions

In Unity 6 and newer, with this option enabled, the SDK no longer needs to go register the IL2CPP processor to calling into the IL2CPP backend. This also means, stacktraces and linenumbers work without debug symbol upload.
Note, that this most likely comes at a cost to performance.

Notes

It is not required to opt-in having stacktraces in the player settings. The exception itself has the proper stacktrace with line numbers.

Image

主要言語
C#
スター
294
フォーク
63
平均マージ
3日 17時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

getsentry/sentry-unity のほかの issue

getsentry/sentry-unity の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。