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

Merge common code bases for TdsParserStateObject.cs (4) #2254

Merged
merged 19 commits into from Jan 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
40d1351
Merge NullBitmap struct of TdsParserStateObject.
panoskj Nov 29, 2023
cae8c3f
Merge "Value Skip Logic" methods of TdsParserStateObject.
panoskj Nov 29, 2023
fde2178
Add RuntimeHelpers.PrepareConstrainedRegions stub in TdsParserStateOb…
panoskj Nov 29, 2023
53e4333
Refactoring of ReadSni in TdsParserStateObject.netcore.cs.
panoskj Nov 29, 2023
9076c6a
Add "missing" RuntimeHelpers.PrepareConstrainedRegions with try/final…
panoskj Nov 29, 2023
cedc2b5
Remove unreachable code from TdsParserStateObject.netfx.cs (condition…
panoskj Nov 29, 2023
40a355c
Replace Thread.MemoryBarrier with Interlocked.MemoryBarrier in TdsPar…
panoskj Nov 29, 2023
2a9558d
Add PacketHandle as an alias of IntPtr in TdsParserStateObject.netfx.…
panoskj Nov 29, 2023
6a8f0d9
Add TdsParserStateObjectFactory.UseManagedSNI, ReadSyncOverAsync and …
panoskj Nov 29, 2023
e22c4e9
Add SessionHandle and ReadAsync in TdsParserStateObject.netfx.cs.
panoskj Nov 29, 2023
4a9ba4e
Port ADP.OnTimeoutAsync to netfx (fixes an edge case bug regarding As…
panoskj Nov 29, 2023
a9b5585
Add CheckConnection in TdsParserStateObject.netfx.cs.
panoskj Nov 29, 2023
e6cb4ab
Whitespace changes. Add a missing private access modifier in TdsParse…
panoskj Dec 4, 2023
0f14302
Merge most "Network/Packet Reading & Processing" methods of TdsParser…
panoskj Dec 4, 2023
e695cc7
NIT: Fix code formatting in UnsafeCreateTimer method.
panoskj Jan 11, 2024
7ca012a
Update src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsP…
panoskj Jan 17, 2024
832e378
Update src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsP…
panoskj Jan 17, 2024
240e242
Update src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsP…
panoskj Jan 17, 2024
619bb4c
Removed dead code.
panoskj Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -856,7 +856,6 @@ internal bool IsConnectionAlive(bool throwOnException)
else
{
uint error;
IntPtr readPacket = IntPtr.Zero;

RuntimeHelpers.PrepareConstrainedRegions();
try
Expand Down Expand Up @@ -887,12 +886,6 @@ internal bool IsConnectionAlive(bool throwOnException)
}
finally
{
if (readPacket != IntPtr.Zero)
{
// Be sure to release packet, otherwise it will be leaked by native.
SNINativeMethodWrapper.SNIPacketRelease(readPacket);
Copy link
Contributor Author

@panoskj panoskj Dec 12, 2023

Choose a reason for hiding this comment

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

Since this code is unreachable, the enclosing try/finally serves no purpose other than whatever RuntimeHelpers.PrepareConstrainedRegions does. I have preserved the try/finally (by adding it in .net core) but I suspect it can be removed, because according to the documentation (emphasis mine):

The PrepareConstrainedRegions method must immediately precede a try block and marks catch, finally, and fault blocks as constrained execution regions.

If I understand correctly, RuntimeHelpers.PrepareConstrainedRegions only affects catch/finally and has no effect if they are empty.

}

}
}
}
Expand Down Expand Up @@ -1777,7 +1770,7 @@ private Task SNIWritePacket(SNIHandle handle, SNIPacket packet, out uint sniErro
return task;
}

#pragma warning restore 420
#pragma warning restore 420

// Sends an attention signal - executing thread will consume attn.
internal void SendAttention(bool mustTakeWriteLock = false, bool asyncClose = false)
Expand Down