Skip to content
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

Xamarin document offline caching and InitCacheFlushTimeout #64

Open
bruno-garcia opened this issue Apr 8, 2021 · 0 comments
Open

Xamarin document offline caching and InitCacheFlushTimeout #64

bruno-garcia opened this issue Apr 8, 2021 · 0 comments
Labels
documentation Improvements or additions to documentation Platform: Xamarin

Comments

@bruno-garcia
Copy link
Member

Recently a user on Discord asked why a crash (throw null) right after SentryXamarin.Init wasn't captured on a Xamarin app.

The explanation is:

When you load the app for the first time, it inits Sentry and immediately crashes. Sentry, writes that crash data to a file (can't send it to Sentry before the app crashes). So when the app restarts, you Init Sentry again, and Sentry sees the file and tries to send. But since that's now blocking the app from launching, it only waits up to 1 second. If ti can't send it to Sentry before that, it lets the app continue to launch. But right after initing Sentry, it crashes again.
So it worked for me, but it might not work for you depending on the latency you have between the device and Sentry for example.
One way around this, is to configure how long you're OK with the SDK blocking the app lunch if it finds a crash file:

SentryXamarin.Init(options =>
{
    options.Dsn = "...";
    options.InitCacheFlushTimeout = TimeSpan.FromSeconds(10);
});

it will wait "up to 10 seconds" for a crash to be sent when the app restarts. The default is 1 second only I believe
You can also turn it off and if the app is just crashing right while opening up, it will just never capture that

Turns out this is actually documented here: https://docs.sentry.io/platforms/dotnet/configuration/options/#init-cache-flush-timeout

It could be beneficial for Xamarin particularly to get more information about this, since offline caching is on by default.

@bruno-garcia bruno-garcia transferred this issue from getsentry/sentry-dotnet Apr 8, 2021
@bruno-garcia bruno-garcia moved this to Needs Discussion in Mobile & Cross Platform SDK Feb 16, 2022
@lucas-zimerman lucas-zimerman added documentation Improvements or additions to documentation Impact: Small labels Apr 19, 2022
@lucas-zimerman lucas-zimerman moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Platform: Xamarin
Projects
Status: Backlog
Development

No branches or pull requests

3 participants