IL2CPP Line Numbers

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)
  • macOS
  • Linux
  • Android
  • iOS

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.

Copied
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.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").