Skip to content

Some attachments not send on MAUI #3101

@pierre-galaup

Description

@pierre-galaup

Important Note

⚠ ⚠ ⚠ 👀 👀 👀
This was an issue with the .NET Runtime. We were keeping it here as a tracking issue (see comment).

It looks like there are finally workarounds available for this however, so we'll get a fix out ASAP. Thanks @tranb3r for following up to let us know!

⚠ ⚠ ⚠ 👀 👀 👀

Package

Sentry.Maui

.NET Flavor

.NET

.NET Version

8.0.0

OS

Android

SDK Version

Sentry.Maui 3.41.3

Self-Hosted Sentry Version

No response

Steps to Reproduce

Hello,

On my MAUI application, I send a "SentrySdk.CaptureMessage" where I configure in the scope a number of attachments which are ZIP files that contain logs (NLog) :

scope.AddAttachment(attachment, AttachmentType.Default, "application/zip");

However, on some phones and quite randomly, some of these files are not sent.
The files are not used and they are all stored in the same directory, and the zip is created in the same way.

I managed, with the Sentry DEBUG set to TRUE, to get the error :

Warning: Failed to serialize envelope item
System.InvalidOperationException: Arg_InvalidOperationException
  at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore`1[[System.Int64, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetStatus(Int16 )
  at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.GetStatus(Int16 )
  at System.IO.Strategies.BufferedFileStreamStrategy.ReadAsync(Byte[] , Int32 , Int32 , CancellationToken )
  at System.IO.FileStream.ReadAsync(Byte[] , Int32 , Int32 , CancellationToken )
  at Sentry.Internal.PartialStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
  at System.IO.Stream.<CopyToAsync>g__Core|27_0(Stream , Stream , Int32 , CancellationToken )
  at Sentry.Protocol.Envelopes.EnvelopeItem.BufferPayloadAsync(IDiagnosticLogger logger, CancellationToken cancellationToken)
  at Sentry.Protocol.Envelopes.EnvelopeItem.SerializeAsync(Stream stream, IDiagnosticLogger logger, CancellationToken cancellationToken)
  at Sentry.Protocol.Envelopes.Envelope.SerializeAsync(Stream stream, IDiagnosticLogger logger, ISystemClock clock, CancellationToken cancellationToken)

I've only managed to reproduce this problem on Android phones.

Can you help me?
Thanks

Expected Result

All attachments send

Actual Result

Some attachments not send

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    No status

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions