Skip to content

fix: Screenshot Capture #2240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

fix: Screenshot Capture #2240

wants to merge 2 commits into from

Conversation

bitsandfoxes
Copy link
Contributor

Fixes #2224, #1827 🎉

The SDK has to wait for the EndOfFrame to capture a screenshot. The behaviour is unreliable otherwise.

Since we're now waiting for EndOfFrame we can now also make sure not to capture more than one screenshot per frame.

Open Question

But that also means, that only the first error in a given frame has a screenshot attached to it?
Do we send the same screenshot multiple times, for each error?

Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Screenshot Capture ([#2240](https://github.com/getsentry/sentry-unity/pull/2240))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 7c90568

{
return @event;
_options = sentryOptions;
_sentryMonoBehaviour = sentryMonoBehaviour ?? SentryMonoBehaviour.Instance;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a public ctor that passes SentryMonoBehaviour.Instance already, having also ?? seems redundant.

Since this is an internal ctor, how about:

Suggested change
_sentryMonoBehaviour = sentryMonoBehaviour ?? SentryMonoBehaviour.Instance;
_sentryMonoBehaviour = sentryMonoBehaviour ?? throw new ArgumentNullException("sentryMonoBehaviour");


public void CaptureScreenshotForEvent(SentryUnityOptions options, SentryId eventId)
{
StartCoroutine(CaptureScreenshot(options, eventId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method returns before the coroutine starts/ends, right? how do we know the screenshot will be taken before the event is created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attached screenshots blank
3 participants