Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update ScreenshotAttachment.cs
  • Loading branch information
jamescrosswell committed Nov 28, 2024
commit 6271ff7c883777cf74a0dfea15d3782e543170cb
7 changes: 3 additions & 4 deletions src/Sentry.Maui/Internal/ScreenshotAttachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public Stream GetStream()
{
var stream = Stream.Null;
// Not including this on Windows specific build because on WinUI this can deadlock.
#if !(__ANDROID__ || __IOS__)
return stream;
#endif
#if (__ANDROID__ || __IOS__)
Stream CaptureScreenBlocking()
{
// This actually runs synchronously (returning Task.FromResult) on the following platforms:
Expand All @@ -60,6 +58,7 @@ Stream CaptureScreenBlocking()
return stream;
}

#endif
#if __IOS__
if (MainThread.IsMainThread)
{
Expand All @@ -75,7 +74,7 @@ Stream CaptureScreenBlocking()
return await screen.OpenReadAsync(ScreenshotFormat.Jpeg).ConfigureAwait(true);
}).ConfigureAwait(false).GetAwaiter().GetResult();
}
#else
#elif __ANDROID__
// Capturing screenshots is not threadsafe on Android
lock (JniLock)
{
Expand Down
Loading