Skip to content

Commit ab27513

Browse files
committed
Merge Dispose
1 parent f824db7 commit ab27513

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ protected TdsParserStateObject(TdsParser parser, TdsParserStateObject physicalCo
7171

7272
internal abstract uint WaitForSSLHandShakeToComplete(out int protocolVersion);
7373

74-
internal abstract void Dispose();
75-
7674
internal abstract uint CheckConnection();
7775

7876
internal int DecrementPendingCallbacks(bool release)

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObject.netfx.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -99,50 +99,6 @@ internal int DecrementPendingCallbacks(bool release)
9999
return remaining;
100100
}
101101

102-
internal void Dispose()
103-
{
104-
105-
SafeHandle packetHandle = _sniPacket;
106-
SafeHandle sessionHandle = _sessionHandle;
107-
SafeHandle asyncAttnPacket = _sniAsyncAttnPacket;
108-
_sniPacket = null;
109-
_sessionHandle = null;
110-
_sniAsyncAttnPacket = null;
111-
112-
DisposeCounters();
113-
114-
if (sessionHandle != null || packetHandle != null)
115-
{
116-
// Comment CloseMARSSession
117-
// UNDONE - if there are pending reads or writes on logical connections, we need to block
118-
// here for the callbacks!!! This only applies to async. Should be fixed by async fixes for
119-
// AD unload/exit.
120-
121-
// TODO: Make this a BID trace point!
122-
RuntimeHelpers.PrepareConstrainedRegions();
123-
try
124-
{ }
125-
finally
126-
{
127-
if (packetHandle != null)
128-
{
129-
packetHandle.Dispose();
130-
}
131-
if (asyncAttnPacket != null)
132-
{
133-
asyncAttnPacket.Dispose();
134-
}
135-
if (sessionHandle != null)
136-
{
137-
sessionHandle.Dispose();
138-
DecrementPendingCallbacks(true); // Will dispose of GC handle.
139-
}
140-
}
141-
}
142-
143-
DisposePacketCache();
144-
}
145-
146102
/// <summary>
147103
/// Checks to see if the underlying connection is still valid (used by idle connection resiliency - for active connections)
148104
/// NOTE: This is not safe to do on a connection that is currently in use

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,50 @@ protected override void RemovePacketFromPendingList(PacketHandle ptr)
208208
}
209209
}
210210

211+
internal override void Dispose()
212+
{
213+
214+
SafeHandle packetHandle = _sniPacket;
215+
SafeHandle sessionHandle = _sessionHandle;
216+
SafeHandle asyncAttnPacket = _sniAsyncAttnPacket;
217+
_sniPacket = null;
218+
_sessionHandle = null;
219+
_sniAsyncAttnPacket = null;
220+
221+
DisposeCounters();
222+
223+
if (sessionHandle != null || packetHandle != null)
224+
{
225+
// Comment CloseMARSSession
226+
// UNDONE - if there are pending reads or writes on logical connections, we need to block
227+
// here for the callbacks!!! This only applies to async. Should be fixed by async fixes for
228+
// AD unload/exit.
229+
230+
// TODO: Make this a BID trace point!
231+
RuntimeHelpers.PrepareConstrainedRegions();
232+
try
233+
{ }
234+
finally
235+
{
236+
if (packetHandle != null)
237+
{
238+
packetHandle.Dispose();
239+
}
240+
if (asyncAttnPacket != null)
241+
{
242+
asyncAttnPacket.Dispose();
243+
}
244+
if (sessionHandle != null)
245+
{
246+
sessionHandle.Dispose();
247+
DecrementPendingCallbacks(true); // Will dispose of GC handle.
248+
}
249+
}
250+
}
251+
252+
DisposePacketCache();
253+
}
254+
211255
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
212256
protected override void FreeGcHandle(int remaining, bool release)
213257
{

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ internal abstract void CreatePhysicalSNIHandle(
514514

515515
protected abstract bool CheckPacket(PacketHandle packet, TaskCompletionSource<object> source);
516516

517+
internal abstract void Dispose();
518+
517519
protected abstract void FreeGcHandle(int remaining, bool release);
518520

519521
internal abstract bool IsFailedHandle();

0 commit comments

Comments
 (0)