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

Fix SendInBackground for iOS #15

Merged
merged 7 commits into from
Mar 10, 2024
Merged

Conversation

ProRedCat
Copy link
Contributor

Issue:
During the creation of the RaygunEnvironmentMessage on iOS some fields require that they are accessed on the Main/UI thread. Previously, the provider was silently failing on this and the crash report would never be send to Raygun. This would also cause an infinite loop if ThrowOnError was enabled.

Fix:
Construct the RaygunEnvironmentMessage on the Main/UI thread and then hand back to the thread the SendInBackground call is using.

Testing:

  • Confirmed <= v1.4.1 does not send crash report on iOS when using SendInBackground
  • Applied MainThread.InvokeOnMainThreadAsync change
  • Confirmed that SendInBackground works on iOS, additionally, tested that it still works on Android and other platforms

Some environment message details required that they be accessed on the UI thread. When using SendInBackground this would silently fail, so we now ensure that the message is created on the Main thread.
Added change log
Copy link
Contributor

@phillip-haydon phillip-haydon left a comment

Choose a reason for hiding this comment

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

Looking good, nice find.

Invoking on UI thread each time to construct the method not only is inefficient, but it may also prevent unhandled exceptions from being processed. We now hook into the MainDisplayInfoChanged event handler to update the dynamic environment details when needed.
@ProRedCat
Copy link
Contributor Author

Testing of the new changes show that the ILogger spam issue goes away and the SendInBackground on iOS works

Copy link
Contributor

@xenolightning xenolightning left a comment

Choose a reason for hiding this comment

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

😎

@ProRedCat ProRedCat merged commit 996531f into master Mar 10, 2024
@ProRedCat ProRedCat deleted the ro/cs-121/fix-send-in-background-ios branch March 13, 2024 02:32
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.

3 participants