Skip to content

Commit 0e3b9b5

Browse files
authored
fix: Uploading all .pdb at Temp/ManagedSymbols for Mono on Windows (#1226)
1 parent 863cda8 commit 0e3b9b5

File tree

2 files changed

+60
-36
lines changed

2 files changed

+60
-36
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixes
66

7+
- Fixed missing debug file upload for assembly definitions for Mono builds ([#1226](https://github.com/getsentry/sentry-unity/pull/1226))
78
- The ANR detection is now unaffected by changes to `Time.timescale` ([#1225](https://github.com/getsentry/sentry-unity/pull/1225))
89

910
### Features

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

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -141,44 +141,67 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
141141
};
142142

143143
addPath(executableName);
144-
if (!isMono)
145-
{
146-
addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame");
147-
}
148-
if (target is BuildTarget.StandaloneWindows64)
149-
{
150-
addPath("UnityPlayer.dll");
151-
addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/Plugins/x86_64/sentry.dll");
152-
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Windows/Sentry/sentry.pdb"));
153-
if (isMono)
154-
{
155-
addPath("MonoBleedingEdge/EmbedRuntime");
156-
addFilesMatching(buildOutputDir, new[] { "*.pdb" });
157-
}
158-
else
159-
{
160-
addPath("GameAssembly.dll");
161-
}
162-
}
163-
else if (target is BuildTarget.StandaloneLinux64)
164-
{
165-
addPath("GameAssembly.so");
166-
addPath("UnityPlayer.so");
167-
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Linux/Sentry/libsentry.dbg.so"));
168-
if (isMono)
169-
{
170-
addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/MonoBleedingEdge/x86_64");
171-
addFilesMatching(buildOutputDir, new[] { "*.debug" });
172-
}
173-
}
174-
else if (target is BuildTarget.StandaloneOSX)
175-
{
176-
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/macOS/Sentry/Sentry.dylib.dSYM"));
177-
}
178144

179-
if (isMono)
145+
switch (target)
180146
{
181-
addFilesMatching($"{projectDir}/Temp", new[] { "**/UnityEngine.*.pdb", "**/Assembly-CSharp.pdb" });
147+
case BuildTarget.StandaloneWindows64:
148+
addPath("UnityPlayer.dll");
149+
addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/Plugins/x86_64/sentry.dll");
150+
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Windows/Sentry/sentry.pdb"));
151+
152+
if (isMono)
153+
{
154+
addPath("MonoBleedingEdge/EmbedRuntime");
155+
addFilesMatching(buildOutputDir, new[] { "*.pdb" });
156+
157+
// Unity stores the .pdb files in './Library/ScriptAssemblies/' and starting with 2020 in
158+
// './Temp/ManagedSymbols/'. We want the one in 'Temp/ManagedSymbols/' specifically.
159+
var managedSymbolsDirectory = $"{projectDir}/Temp/ManagedSymbols";
160+
if (Directory.Exists(managedSymbolsDirectory))
161+
{
162+
addFilesMatching(managedSymbolsDirectory, new[] { "*.pdb" });
163+
}
164+
}
165+
else // IL2CPP
166+
{
167+
addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame");
168+
addPath("GameAssembly.dll");
169+
}
170+
break;
171+
case BuildTarget.StandaloneLinux64:
172+
addPath("GameAssembly.so");
173+
addPath("UnityPlayer.so");
174+
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Linux/Sentry/libsentry.dbg.so"));
175+
176+
if (isMono)
177+
{
178+
addPath(Path.GetFileNameWithoutExtension(executableName) + "_Data/MonoBleedingEdge/x86_64");
179+
addFilesMatching(buildOutputDir, new[] { "*.debug" });
180+
181+
var managedSymbolsDirectory = $"{projectDir}/Temp/ManagedSymbols";
182+
if (Directory.Exists(managedSymbolsDirectory))
183+
{
184+
addFilesMatching(managedSymbolsDirectory, new[] { "*.pdb" });
185+
}
186+
}
187+
else // IL2CPP
188+
{
189+
addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame");
190+
}
191+
break;
192+
case BuildTarget.StandaloneOSX:
193+
addPath(Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/macOS/Sentry/Sentry.dylib.dSYM"));
194+
195+
if (isMono)
196+
{ }
197+
else // IL2CPP
198+
{
199+
addPath(Path.GetFileNameWithoutExtension(executableName) + "_BackUpThisFolder_ButDontShipItWithYourGame");
200+
}
201+
break;
202+
default:
203+
logger.LogError($"Symbol upload for '{target}' is currently not supported.");
204+
break;
182205
}
183206

184207
var cliArgs = "upload-dif ";

0 commit comments

Comments
 (0)