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

Discuss CancelationToken on FormsApplicationListener #109

Open
lucas-zimerman opened this issue Apr 6, 2022 · 1 comment
Open

Discuss CancelationToken on FormsApplicationListener #109

lucas-zimerman opened this issue Apr 6, 2022 · 1 comment
Labels
enhancement New feature or request Platform: Xamarin

Comments

@lucas-zimerman
Copy link
Collaborator

To not lose the comment from Matt

#108 (review)

Yikes. I see this was in the old code and you are just refactoring, but we really shouldn't completely lose this task. It should be saved somewhere. We should also register it for cancellation so it can be shut down gracefully. I'm OK if this is done in a future PR, but wanted to point it out.

On

public void Invoke() =>
//Don't lock the main Thread while waiting for the current application to be created.
Task.Run(async () =>
{
var application = await GetCurrentApplication().ConfigureAwait(false);
if (application is null)
{
_options.DiagnosticLogger?.Log(SentryLevel.Warning, "Sentry.Xamarin.Forms timeout for tracking Application.Current. Navigation tracking is going to be disabled");
return;
}
foreach(var hook in _listeners)
{
hook.Invoke(application);
}
});

@bruno-garcia
Copy link
Member

Task.Run() should have the value assigned somewhere and the result/exception inspected, or at least a whole try/catch in the body handling any error (we should do this anyway). Also we could go with ContinuesWith(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Xamarin
Projects
Status: Backlog
Development

No branches or pull requests

3 participants