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

Mention that sentry needs to be initialised before adding context for sentry native #11242

Closed
moritzsur opened this issue Sep 5, 2024 · 2 comments
Assignees

Comments

@moritzsur
Copy link

Core or SDK?

Platform/SDK

Which part? Which one?

Sentry Native

Description

Not yet mentioned in the native docs

Suggested Solution

Change the code example from

#include <sentry.h>

sentry_value_t character = sentry_value_new_object();
sentry_value_set_by_key(character, "name", sentry_value_new_string("Mighty Fighter"));
sentry_value_set_by_key(character, "age", sentry_value_new_int32(19));
sentry_value_set_by_key(character, "attack_type", sentry_value_new_string("melee"));
sentry_set_context("character", character);

to

#include <sentry.h>

//...
//sentry_init(options);

sentry_value_t character = sentry_value_new_object();
sentry_value_set_by_key(character, "name", sentry_value_new_string("Mighty Fighter"));
sentry_value_set_by_key(character, "age", sentry_value_new_int32(19));
sentry_value_set_by_key(character, "attack_type", sentry_value_new_string("melee"));
sentry_set_context("character", character);
@getsantry
Copy link
Contributor

getsantry bot commented Sep 5, 2024

Auto-routing to @getsentry/product-owners-issues for triage ⏲️

@JoshuaMoelans
Copy link
Member

Hi, thanks for raising this issue. On our page about configuring the native SDK we mention that this configuration should happen as early as possible within your application. So, by the time you add context, sentry_init(options) should have been called already.

I can see how this is easy to overlook, but to avoid clutter in our other docs pages we don't show this initialization on every code snippet.

@JoshuaMoelans JoshuaMoelans closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Archived in project
Development

No branches or pull requests

3 participants