Skip to content

fix: Collect MainThreadData first thing in Init #2281

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bitsandfoxes
Copy link
Contributor

Fixes #2247

Since the native configuration now gets called from within the SDK it does not need to be pulled out into Android.Configure and can universally be the first thing the SDK does.

This works because Init is getting automatically called in SentryInitialization.cs

private static void Init()
{
// We're setting up `UnityInfo` and the platform specific configure callbacks as the very first thing.
// These are required to be available during initialization.
SetUpPlatformServices();
// Loading the options invokes the ScriptableOption`Configure` callback. Users can disable the SDK via code.
var options = ScriptableSentryUnityOptions.LoadSentryUnityOptions();
if (options != null && options.ShouldInitializeSdk())
{
SentrySdk.Init(options);
}
else
{

#skip-changelog

@bitsandfoxes bitsandfoxes marked this pull request as ready for review August 14, 2025 14:48
@limbonaut
Copy link
Collaborator

LGTM

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.

MainThreadData.CollectData is getting called twice
2 participants