-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add Async API Tests for Timeout #1
Add Async API Tests for Timeout #1
Conversation
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs
Outdated
Show resolved
Hide resolved
…syncTimeoutTest.cs
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs
Outdated
Show resolved
Hide resolved
…syncTimeoutTest.cs
src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTimeoutTest.cs
Outdated
Show resolved
Hide resolved
…syncTimeoutTest.cs
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs
Outdated
Show resolved
Hide resolved
…ent/TdsParserStateObject.cs
// Take lock and send attention | ||
bool releaseLock = false; | ||
if ((mustTakeWriteLock) && (!_parser.Connection.ThreadHasParserLockForClose)) | ||
{ | ||
releaseLock = true; | ||
_parser.Connection._parserLock.Wait(canReleaseFromAnyThread: false); | ||
_parser.Connection.ThreadHasParserLockForClose = true; | ||
} | ||
try | ||
{ | ||
// Check again (just in case the connection was closed while we were waiting) | ||
if (_parser.State == TdsParserState.Closed || _parser.State == TdsParserState.Broken) | ||
{ | ||
releaseLock = true; | ||
_parser.Connection._parserLock.Wait(canReleaseFromAnyThread: false); | ||
_parser.Connection.ThreadHasParserLockForClose = true; | ||
return; | ||
} | ||
try | ||
{ | ||
// Check again (just in case the connection was closed while we were waiting) | ||
if (_parser.State == TdsParserState.Closed || _parser.State == TdsParserState.Broken) | ||
{ | ||
return; | ||
} | ||
|
||
uint sniError; | ||
_parser._asyncWrite = false; // stop async write | ||
SNIWritePacket(attnPacket, out sniError, canAccumulate: false, callerHasConnectionLock: false); | ||
SqlClientEventSource.Log.TryTraceEvent("<sc.TdsParser.SendAttention|INFO> Send Attention ASync."); | ||
} | ||
finally | ||
uint sniError; | ||
_parser._asyncWrite = false; // stop async write | ||
SNIWritePacket(attnPacket, out sniError, canAccumulate: false, callerHasConnectionLock: false); | ||
SqlClientEventSource.Log.TryTraceEvent("<sc.TdsParser.SendAttention|INFO> Send Attention ASync."); | ||
} | ||
finally | ||
{ | ||
if (releaseLock) | ||
{ | ||
if (releaseLock) | ||
{ | ||
_parser.Connection.ThreadHasParserLockForClose = false; | ||
_parser.Connection._parserLock.Release(); | ||
} | ||
_parser.Connection.ThreadHasParserLockForClose = false; | ||
_parser.Connection._parserLock.Release(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind reverting this indentation change? The IDE isn't seeing inside the #ifdef's and is taking the block 1 step too far left as a result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed the brackets, so they won't bother again.
* Removing BinaryFormatter from NetFx * review comments * fix version typo * remove extra line * Reverted SqlException Test * review comments * Review comment * Desrialize * addressing review comments * Fix exception in deserialization (#1) * review comments * add extra line to the end of strings designer * end of line Co-authored-by: jJRahnama <[email protected]> Co-authored-by: Karina Zhou <[email protected]>
All tests passing.