IL2CPP Line Numbers
This feature is available from Unity versions
2021.3 onwards. We are running tests in CI against the current LTS, starting from
Unity provides you the option to select IL2CPP as your scripting backend. This leads to C++ code being generated from your compiled C# (IL) code, hence the name
IL to CPP.
The Sentry SDK provides line number support for IL2CPP builds for the following platforms:
- Windows (*currently limited to Unity 2021.3 or newer)
When you build with IL2CPP, errors in your game will happen in the native code. Also, the mapping between your C# code and the generated C++ code is part of the build process and isn't shipped with your game. That means the event the Sentry SDK reports can only contain the native stack trace. To provide you with C# line numbers, the Sentry server needs to have access to that line mapping through Debug Information Files.
This feature is enabled by default. You can opt out of it through the editor configuration window by selecting Tools -> Sentry -> Advanced -> IL2CPP line numbers or programmatically.
options.Il2CppLineNumberSupportEnabled = false;
The support for line numbers in C# Exceptions with IL2CPP relies on the debug symbol upload. With the automated debug symbol upload enabled, the Sentry SDK will upload the line mapping automatically.