Follow-up issue to #2641
There might be a good pre-existing reason to it, but this isn't clear from the code/docs. The rendering order compared to Unreal is different (so screenshots are only available at EndOfFrame), but maybe there is a possibility of delaying the event capture until after the screenshot was captured?
The (broken as reported in #2641) flow is currently
SentrySdk.CaptureMessage("...") → SentryClient.cs:316 — DoSendEvent(@event) begins
SentryClient.cs:356 — ProcessEvent calls ScreenshotEventProcessor.Process(@event)
ScreenshotEventProcessor.cs:30 — queues coroutine with @event in closure
SentryMonoBehaviour.cs:69 — StartCoroutine → coroutine runs until yield return WaitForEndOfFrame() → pauses
SentryClient.cs:362 — BeforeSend runs → returns null → event dropped
SentryClient.cs:365 — returns SentryId.Empty
End of frame:
ScreenshotEventProcessor.cs:54 — coroutine resumes, BeforeCaptureScreenshot callback runs
ScreenshotEventProcessor.cs:59 — captures screenshot
ScreenshotEventProcessor.cs:95 — CaptureAttachment(@event.EventId, attachment) — sends orphaned envelope
Follow-up issue to #2641
There might be a good pre-existing reason to it, but this isn't clear from the code/docs. The rendering order compared to Unreal is different (so screenshots are only available at
EndOfFrame), but maybe there is a possibility of delaying the event capture until after the screenshot was captured?The (broken as reported in #2641) flow is currently
SentrySdk.CaptureMessage("...") → SentryClient.cs:316 —
DoSendEvent(@event)beginsSentryClient.cs:356 — ProcessEvent calls
ScreenshotEventProcessor.Process(@event)ScreenshotEventProcessor.cs:30 — queues coroutine with
@eventin closureSentryMonoBehaviour.cs:69 — StartCoroutine → coroutine runs until
yield return WaitForEndOfFrame()→ pausesSentryClient.cs:362 —
BeforeSendruns → returns null → event droppedSentryClient.cs:365 — returns SentryId.Empty
End of frame:
ScreenshotEventProcessor.cs:54 — coroutine resumes,
BeforeCaptureScreenshotcallback runsScreenshotEventProcessor.cs:59 — captures screenshot
ScreenshotEventProcessor.cs:95 —
CaptureAttachment(@event.EventId, attachment)— sends orphaned envelope