Skip to content

Commit ed1e65f

Browse files
committed
add diagnostic log message for native transport exceptions
1 parent a1d8c13 commit ed1e65f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/Sentry/Platforms/Native/CFunctions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@ internal struct sentry_value_t
396396
[UnmanagedCallersOnly]
397397
private static void nativeTransport(IntPtr envelope, IntPtr state)
398398
{
399+
var options = GCHandle.FromIntPtr(state).Target as SentryOptions;
399400
try
400401
{
401-
var options = GCHandle.FromIntPtr(state).Target as SentryOptions;
402402
if (options is not null)
403403
{
404404
var data = sentry_envelope_serialize(envelope, out var size);
@@ -409,9 +409,10 @@ private static void nativeTransport(IntPtr envelope, IntPtr state)
409409
client.SendAsync(request).GetAwaiter().GetResult();
410410
}
411411
}
412-
catch
412+
catch (Exception e)
413413
{
414414
// never allow an exception back to native code - it would crash the app
415+
options?.DiagnosticLogger?.LogError(e, "Exception in native transport callback. The native envelope will not be sent.");
415416
}
416417
finally
417418
{

0 commit comments

Comments
 (0)