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 trace propagation targets setter #2035

Merged
merged 4 commits into from
Nov 9, 2022

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Nov 9, 2022

While testing with .NET 7 (in #1952), I found that configuration bindings for lists have changed. It used to be that an existing list would have its Add method called to incorporate items during binding. Now it appears the whole list is replaced.

With SentryOptions.TracePropagationTargets, we use [".*"] by default. If the user provides a different list via config, or adds to the existing list in code, we have to clear the wildcard automatically.

With these changes, we now do this correctly for both adding to this or replacing the list - so it works correctly on all targets and we don't have to make any assumptions about configuration binding behavior per version.

@mattjohnsonpint mattjohnsonpint marked this pull request as draft November 9, 2022 02:02
@mattjohnsonpint mattjohnsonpint marked this pull request as ready for review November 9, 2022 02:11
Comment on lines +599 to +601
// NOTE: During configuration binding, .NET 6 and lower used to just call Add on the existing item.
// .NET 7 changed this to call the setter with an array that already starts with the old value.
// We have to handle both cases.
Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds like a huge gotcha.

@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) November 9, 2022 15:29
@mattjohnsonpint mattjohnsonpint merged commit 6af8ce3 into main Nov 9, 2022
@mattjohnsonpint mattjohnsonpint deleted the fix-tracepropagationtargets branch November 9, 2022 15:41
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.

None yet

2 participants