Skip to content

Validate the Cosmos session token management mode - #39658

Merged
AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/cosmos-session-token-mode-undefined-value
Nov 17, 2026
Merged

AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/cosmos-session-token-mode-undefined-value

Conversation

@ilkertskn

Copy link
Copy Markdown
Contributor

WithConnectionMode rejects values that aren't defined in ConnectionMode, but WithSessionTokenManagementMode stored any value. An undefined mode was then treated by SessionTokenStorage as neither fully automatic nor one of the manual modes: tokens were tracked and sent, and the manual session token APIs were enabled, a behavior that no mode describes.

Throw ArgumentOutOfRangeException for undefined values, as for ConnectionMode.

  • [x ] I've read the guidelines for contributing and seen the walkthrough
  • [x ] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • [x ] The code builds and tests pass locally (also verified by our automated build checks)
  • [x ] Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • [x ] Tests for the changes have been added (for bug fixes / features)
  • [x ] Code follows the same patterns and style as existing code in this repo

WithConnectionMode rejects values that aren't defined in ConnectionMode,
but WithSessionTokenManagementMode stored any value. An undefined mode
was then treated by SessionTokenStorage as neither fully automatic nor
one of the manual modes: tokens were tracked and sent, and the manual
session token APIs were enabled, a behavior that no mode describes.

Throw ArgumentOutOfRangeException for undefined values, as for
ConnectionMode.

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution!

@AndriySvyryd
AndriySvyryd merged commit 35452b5 into dotnet:main Nov 17, 2026
20 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants