Skip to content

fix: parse breadcrumb levels with the invariant culture - #5977

Open
menes97 wants to merge 1 commit into
getsentry:mainfrom
menes97:fix/breadcrumb-level-invariant
Open

menes97 wants to merge 1 commit into
getsentry:mainfrom
menes97:fix/breadcrumb-level-invariant

Conversation

@menes97

@menes97 menes97 commented Nov 21, 2026

Copy link
Copy Markdown

Description

Breadcrumb.FromJson upper-cases the level with ToUpper(), which uses the current culture. Under a Turkish (or Azerbaijani) culture, "warning" becomes "WARNİNG" (dotted capital I), matches none of the cases and falls back to Info. A warning breadcrumb read back from JSON, for example from a cached envelope, loses its level on those machines. This PR uses ToUpperInvariant() instead.

NativeScopeObserver has the same problem in the other direction: breadcrumb.Level.ToString().ToLower() turns Info into "ınfo" (dotless i) before passing it to the native SDK. It now uses ToLowerInvariant(), like Breadcrumb.WriteTo already does.

Tests: added FromJson_Level_UnderTurkishCulture_ParsesExpectedLevel, which sets tr-TR and parses "warning" and "debug".

I ran Sentry.Tests on net10.0 on a machine whose culture is tr-TR:

  • before the fix: 4 failures. They are the new test, the existing FromJson_Level_ParsesExpectedLevel("warning"), and the two SerializeObject_AllPropertiesSetToNonDefault round trips in SentryEventTests and SentryTransactionTests, which include a warning breadcrumb;
  • after the fix: 3092 passed, 0 failed.

Issues

No existing issue; found while checking .NET libraries for culture-dependent casing.

This PR was prepared with AI assistance (Claude Code); I reviewed the change and ran the tests above.

🤖 Generated with Claude Code

Breadcrumb.FromJson upper-cased the level with the current culture. Under
tr-TR, "warning" becomes "WARNİNG", matches no case and falls back to Info.
NativeScopeObserver lower-cased the level the same way, sending "ınfo" to
the native SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 6668275.

The model rated this change low. It was raised to medium because:

  • R7: the model was not confident enough that the change is low

This label is a hint for reviewers, not an approval.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant