Skip to content

fix: line number support for unity 6.5 and newer - #2805

Open
bitsandfoxes wants to merge 10 commits into
mainfrom
feat/fix-symbols-unity-6.5
Open

fix: line number support for unity 6.5 and newer#2805
bitsandfoxes wants to merge 10 commits into
mainfrom
feat/fix-symbols-unity-6.5

Conversation

@bitsandfoxes

Copy link
Copy Markdown
Contributor

Context

In Unity 6.3 and older, when building the game you'd end up with an output folder looking like that

.
├── game-name_BackUpThisFolder_ButDontShipItWithYourGame
│   ├── GameAssembly.dSYM
│   ├── il2cppOutput
│   └── Managed
|        ├ all-the-dlls.dll
|        └ all-the-dlls.pdb
└── game-name.app

The Managed directory would contain all the stripped down .dll and matching .pdb files. Starting with 6.5 the Managed folder contains the .dll only. To get to the .pdb you will need to do a Development build and opt-in to Script Debugging. Not ideal.

What this does

These options provide the UnityLinker with the additional argument --link-symbols.

So starting with Unity 6.5 on top of adding --emit-source-mapping to IL2CPP we need to add this argument when the UnityLinker gets invoked. Since there are no callbacks and the backdoor of AdditionalIl2CppArguments only works for IL2CPP we're putting it on the environment in the pre-build-step to be picked up.

We'll need to find a less brittle way of getting to the debug symbols

Before

Screenshot 2026-08-07 at 15 14 31

After

Screenshot 2026-08-07 at 15 24 22

Testing

We're now also validating that the stack trace on the resulting events coming from the integration tests do have correct line numbers.

Comment thread src/Sentry.Unity.Editor/Il2CppBuildPreProcess.cs Outdated
@bitsandfoxes bitsandfoxes changed the title write additional unitylinker args fix: line number support for unity 6.5 and newer Aug 7, 2026
Comment thread src/Sentry.Unity.Editor/Il2CppBuildPreProcess.cs Outdated
bitsandfoxes and others added 2 commits August 7, 2026 17:59
Start Unity Editor with --link-symbols in its process environment to determine whether Linux Bee reads the setting before build preprocessing.

Refs #2805

Co-Authored-By: OpenCode <noreply@openai.com>
Comment thread .github/workflows/test-build-linux.yml Outdated
The process-start linker argument reached UnityLinker but did not restore Linux source resolution, so remove the temporary CI override.

Refs #2805

Co-Authored-By: OpenCode <noreply@openai.com>
Comment thread src/Sentry.Unity.Editor/Il2CppBuildPreProcess.cs Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7844761. Configure here.

Comment thread test/IntegrationTest/Integration.Tests.ps1
Comment thread src/Sentry.Unity.Editor/Il2CppBuildPreProcess.cs Outdated
Comment on lines +352 to +354
if ($script:Platform -in "WebGL", "Linux") {
Set-ItResult -Skipped -Because "Source-line assertions are unsupported on $script:Platform"
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The test skip condition checks for $script:Platform being "Linux", but for Linux builds, it's set to "Desktop". This causes a test to run when it should be skipped.
Severity: MEDIUM

Suggested Fix

Update the skip condition to correctly identify the Linux environment. Since Linux builds set $script:Platform to "Desktop", the condition should be modified to account for this. For example, you could check if $IsLinux is true when $script:Platform is "Desktop", or adjust the platform value assignment in integration-test.ps1.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: test/IntegrationTest/Integration.Tests.ps1#L352-L354

Potential issue: The test skip condition `if ($script:Platform -in "WebGL", "Linux")` is
intended to prevent a line number assertion test from running on Linux. However, the
build script sets `$script:Platform` to "Desktop" for Linux environments. As a result,
the condition is never met on Linux, and the test proceeds to run. This test is expected
to fail on Linux because the `--link-symbols` feature, which is necessary for correct
line number resolution, is not supported. This will cause the CI pipeline to fail for
Linux builds, contrary to the author's intent to exclude Linux from this specific test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant