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

SqlConnection.Clone doesn't copy AccessTokenCallback #2524

Closed
rayao opened this issue May 22, 2024 · 5 comments · Fixed by #2525
Closed

SqlConnection.Clone doesn't copy AccessTokenCallback #2524

rayao opened this issue May 22, 2024 · 5 comments · Fixed by #2525
Labels
🐛 Bug! Issues that are bugs in the drivers we maintain.

Comments

@rayao
Copy link

rayao commented May 22, 2024

I'm not sure it's bug or by design, if by design, can you explain why?

@JRahnama JRahnama added the 🆕 Triage Needed For new issues, not triaged yet. label May 22, 2024
@kf-gonzalez2
Copy link

Can you please elaborate further on the issue? please include any repro steps or more explanation

@kf-gonzalez2 kf-gonzalez2 added ⏳ Waiting for Customer Issues/PRs waiting for user response/action. and removed 🆕 Triage Needed For new issues, not triaged yet. labels May 22, 2024
@ErikEJ
Copy link
Contributor

ErikEJ commented May 22, 2024

@kf-gonzalez2 There is a originating issue here: ErikEJ/EntityFramework6PowerTools#147 and a follow up PR for EF 6 here: ErikEJ/EntityFramework6PowerTools#150 - I think this could be "by design"

@roji
Copy link
Member

roji commented May 22, 2024

FWIW I think the main usefulness in DbConnection.Clone() is precisely to clone the authentication information, so that the clone can actually be opened successfully. For example, the password does get copied to clones, so I'm not sure why AccessTokenCallback would be treated any differently:

var connection1 = new SqlConnection("Server=localhost;Database=test;User=SA;Password=Abcd5678;Connect Timeout=60;ConnectRetryCount=0;Encrypt=false");
connection1.Open();

var connection2 = (SqlConnection)((ICloneable)connection1).Clone();
connection2.Open();

@ErikEJ
Copy link
Contributor

ErikEJ commented May 22, 2024

@roji Thanks for joining! Yeah. could be an oversight - AccessTokenCallback was just added to 5.2.

Would be great to get it fixed in SqlClient. so that Microsoft.EntityFramwork.SqlServer could take advantage (by using a newer SqlClient). I think adding the above "fix" to that is out of scope.

@David-Engel
Copy link
Contributor

I agree, this seems to be a simple oversight in the original implementation. We should fix this in MDS.

@David-Engel David-Engel added 🐛 Bug! Issues that are bugs in the drivers we maintain. and removed ⏳ Waiting for Customer Issues/PRs waiting for user response/action. labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug! Issues that are bugs in the drivers we maintain.
Projects
Development

Successfully merging a pull request may close this issue.

6 participants