Skip to content

Commit 24f1816

Browse files
committed
chore: improve stack trace logging
1 parent df2fbbb commit 24f1816

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/Sentry/Extensibility/SentryStackTraceFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class SentryStackTraceFactory : ISentryStackTraceFactory
3333

3434
var stackTrace = exception is null ? new StackTrace(true) : new StackTrace(exception, true);
3535
var result = SentryDebugStackTrace.Create(_options, stackTrace, isCurrentStackTrace);
36+
_options.LogDebug("Created SentryDebugStackTrace with {0} frames.", result.Frames.Count);
3637
return result.Frames.Count != 0 ? result : null;
3738
}
3839
}

src/Sentry/Internal/SentryDebugStackTrace.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal void MergeDebugImagesInto(SentryEvent @event)
6262
}
6363
_debugImagesMerged = true;
6464

65+
_options.LogDebug("Merging {0} debug images from stacktrace.", _debugImages.Count);
6566
if (_debugImages.Count == 0)
6667
{
6768
return;
@@ -156,6 +157,7 @@ private IEnumerable<SentryStackFrame> CreateFrames(StackTrace stackTrace, bool i
156157
&& stackFrame.GetMethod() is { } method
157158
&& method.DeclaringType?.AssemblyQualifiedName?.StartsWith("Sentry") == true)
158159
{
160+
_options.LogDebug("Skipping initial stack frame '{0}'", method.Name);
159161
continue;
160162
}
161163

@@ -379,6 +381,8 @@ private static void DemangleLambdaReturnType(SentryStackFrame frame)
379381
var codeFile = module.FullyQualifiedName;
380382
if (!File.Exists(codeFile))
381383
{
384+
_options.LogDebug("Skipping DebugImage for module '{0}' because CodeFile wasn't found: '{1}'",
385+
module.Name, codeFile);
382386
return null;
383387
}
384388
using var stream = File.OpenRead(codeFile);
@@ -423,6 +427,7 @@ private static void DemangleLambdaReturnType(SentryStackFrame frame)
423427
// well, we are out of luck :-(
424428
if (debugId == null)
425429
{
430+
_options.LogDebug("Skipping DebugImage for module '{0}' because DebugId couldn't be determined", module.Name);
426431
return null;
427432
}
428433

test/Sentry.Tests/HubTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ public async Task CaptureEvent_ActiveTransaction_UnhandledExceptionTransactionEn
472472
});
473473

474474
await Verifier.Verify(worker.Envelopes)
475+
.UniqueForRuntimeAndVersion()
475476
.IgnoreStandardSentryMembers()
476477
.IgnoreMember("Stacktrace")
477478
.IgnoreMember<SentryThread>(_ => _.Name)
478-
.UniqueForRuntimeAndVersion()
479479
.IgnoreInstance<DebugImage>(_ => _.DebugFile.Contains("Xunit.SkippableFact"));
480480
}
481481

0 commit comments

Comments
 (0)