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

System.Data.SqlClient.SqlCommand.Prepare() calls SqlStatistics.StopTimer() outside finally block #16131

Closed
Dmitry-Me opened this issue Jan 15, 2016 · 0 comments · Fixed by dotnet/SqlClient#232

Comments

@Dmitry-Me
Copy link
Contributor

All methods of System.Data.SqlClient.SqlCommand which call SqlStatistics.StartTimer() go like this:

SqlStatistics statistics = null;
try {
    statistics = SqlStatistics.StartTimer(Statistics);
    doSomethingUseful();
 } finally {
     SqlStatistics.StopTimer(statistics);
 }

but SqlCommand.Prepare() does not follow that pattern - it contains StopTimer() call outside finally so StopTimer() is not guaranteed to run should useful code throw an exception.

@saurabh500 saurabh500 removed their assignment Mar 19, 2017
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants