Skip to content

Thread safety of Microsoft.Data.SqlClient.SqlConnection #3221

Closed Answered by roji
kentcb asked this question in Q&A
Discussion options

You must be logged in to vote

That is wrong, SqlConnection doesn't provide thread-safety, even when MARS is enabled, as per the docs. What MARS provides is the ability to have multiple resultsets open concurrently, but the SqlConnection instance itself must be accessed one thread at a time.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@roji
Comment options

roji Mar 28, 2025
Collaborator

Answer selected by David-Engel
@kentcb
Comment options

@roji
Comment options

roji Mar 30, 2025
Collaborator

@kentcb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants