Skip to content

Commit 41e23b1

Browse files
authored
Add debug symbol uploads for Win32 and MacOS Mono builds (#2021)
1 parent 89fd6fc commit 41e23b1

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- Then targeting desktop platforms, the SDK now also uploads debugging symbols when native support is disabled. ([#2021](https://github.com/getsentry/sentry-unity/pull/2021))
8+
- The SDK will now upload debugging symobol files for macOS mono builds.([#2021](https://github.com/getsentry/sentry-unity/pull/2021))
9+
510
### Dependencies
611

712
- Bump CLI from v2.41.1 to v2.42.1 ([#2026](https://github.com/getsentry/sentry-unity/pull/2026))

src/Sentry.Unity.Editor/Native/BuildPostProcess.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
2929
var isMono = PlayerSettings.GetScriptingBackend(targetGroup) == ScriptingImplementation.Mono2x;
3030
#pragma warning restore CS0618
3131

32+
var buildOutputDir = Path.GetDirectoryName(executablePath);
33+
var executableName = Path.GetFileName(executablePath);
34+
3235
try
3336
{
3437
if (options is null)
@@ -52,16 +55,17 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
5255

5356
logger.LogDebug("Adding native support.");
5457

55-
var buildOutputDir = Path.GetDirectoryName(executablePath);
56-
var executableName = Path.GetFileName(executablePath);
5758
AddCrashHandler(logger, target, buildOutputDir, executableName);
58-
UploadDebugSymbols(logger, target, buildOutputDir, executableName, options, cliOptions, isMono);
5959
}
6060
catch (Exception e)
6161
{
6262
logger.LogError(e, "Failed to add the Sentry native integration to the built application");
6363
throw new BuildFailedException("Sentry Native BuildPostProcess failed");
6464
}
65+
finally
66+
{
67+
UploadDebugSymbols(logger, target, buildOutputDir, executableName, options, cliOptions, isMono);
68+
}
6569
}
6670

6771
private static bool IsEnabledForPlatform(BuildTarget target, SentryUnityOptions options) => target switch
@@ -143,6 +147,7 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
143147

144148
switch (target)
145149
{
150+
case BuildTarget.StandaloneWindows:
146151
case BuildTarget.StandaloneWindows64:
147152
addPath("UnityPlayer.dll");
148153
addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/Plugins/x86_64/sentry.dll");
@@ -192,7 +197,17 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
192197
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/macOS/Sentry/Sentry.dylib.dSYM"));
193198

194199
if (isMono)
195-
{ }
200+
{
201+
addFilesMatching(buildOutputDir, new[] { "*.pdb" });
202+
203+
// Unity stores the .pdb files in './Library/ScriptAssemblies/' and starting with 2020 in
204+
// './Temp/ManagedSymbols/'. We want the one in 'Temp/ManagedSymbols/' specifically.
205+
var managedSymbolsDirectory = $"{projectDir}/Temp/ManagedSymbols";
206+
if (Directory.Exists(managedSymbolsDirectory))
207+
{
208+
addFilesMatching(managedSymbolsDirectory, new[] { "*.pdb" });
209+
}
210+
}
196211
else // IL2CPP
197212
{
198213
addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame");

0 commit comments

Comments
 (0)