diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs
index 6c32e9594d..b1bb4065c8 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObject.netcore.cs
@@ -16,6 +16,17 @@ namespace Microsoft.Data.SqlClient
{
internal abstract partial class TdsParserStateObject
{
+ private struct RuntimeHelpers
+ {
+ ///
+ /// This is a no-op in netcore version. Only needed for merging with netfx codebase.
+ ///
+ [Conditional("NETFRAMEWORK")]
+ internal static void PrepareConstrainedRegions()
+ {
+ }
+ }
+
private static readonly ContextCallback s_readAsyncCallbackComplete = ReadAsyncCallbackComplete;
// Timeout variables
@@ -77,34 +88,6 @@ internal abstract SessionHandle SessionHandle
get;
}
- private partial struct NullBitmap
- {
- internal bool TryInitialize(TdsParserStateObject stateObj, int columnsCount)
- {
- _columnsCount = columnsCount;
- // 1-8 columns need 1 byte
- // 9-16: 2 bytes, and so on
- int bitmapArrayLength = (columnsCount + 7) / 8;
-
- // allow reuse of previously allocated bitmap
- if (_nullBitmap == null || _nullBitmap.Length != bitmapArrayLength)
- {
- _nullBitmap = new byte[bitmapArrayLength];
- }
-
- // read the null bitmap compression information from TDS
- if (!stateObj.TryReadByteArray(_nullBitmap, _nullBitmap.Length))
- {
- return false;
- }
-
- SqlClientEventSource.Log.TryAdvancedTraceEvent("TdsParserStateObject.NullBitmap.Initialize | INFO | ADV | State Object Id {0}, NBCROW bitmap received, column count = {1}", stateObj.ObjectID, columnsCount);
- SqlClientEventSource.Log.TryAdvancedTraceBinEvent("TdsParserStateObject.NullBitmap.Initialize | INFO | ADV | State Object Id {0}, NBCROW bitmap data. Null Bitmap {1}, Null bitmap length: {2}", stateObj.ObjectID, _nullBitmap, (ushort)_nullBitmap.Length);
-
- return true;
- }
- }
-
/////////////////////
// General methods //
/////////////////////
@@ -279,568 +262,6 @@ internal void StartSession(object cancellationOwner)
_cancellationOwner.Target = cancellationOwner;
}
- /////////////////////////////////////////
- // Value Skip Logic //
- /////////////////////////////////////////
-
-
- // Reads bytes from the buffer but doesn't return them, in effect simply deleting them.
- // Does not handle plp fields, need to use SkipPlpBytesValue for those.
- // Does not handle null values or NBC bitmask, ensure the value is not null before calling this method
- internal bool TrySkipLongBytes(long num)
- {
- Debug.Assert(_syncOverAsync || !_asyncReadWithoutSnapshot, "This method is not safe to call when doing sync over async");
-
- while (num > 0)
- {
- int cbSkip = (int)Math.Min(int.MaxValue, num);
- if (!TryReadByteArray(Span.Empty, cbSkip))
- {
- return false;
- }
- num -= cbSkip;
- }
-
- return true;
- }
-
- // Reads bytes from the buffer but doesn't return them, in effect simply deleting them.
- internal bool TrySkipBytes(int num)
- {
- Debug.Assert(_syncOverAsync || !_asyncReadWithoutSnapshot, "This method is not safe to call when doing sync over async");
- return TryReadByteArray(Span.Empty, num);
- }
-
- /////////////////////////////////////////
- // Network/Packet Reading & Processing //
- /////////////////////////////////////////
-
-#if DEBUG
- private string _lastStack;
-#endif
-
- internal bool TryReadNetworkPacket()
- {
-#if DEBUG
- Debug.Assert(!_shouldHaveEnoughData || _attentionSent, "Caller said there should be enough data, but we are currently reading a packet");
-#endif
-
- if (_snapshot != null)
- {
- if (_snapshotReplay)
- {
-#if DEBUG
- // in debug builds stack traces contain line numbers so if we want to be
- // able to compare the stack traces they must all be created in the same
- // location in the code
- string stackTrace = Environment.StackTrace;
-#endif
- if (_snapshot.MoveNext())
- {
-#if DEBUG
- if (s_checkNetworkPacketRetryStacks)
- {
- _snapshot.CheckStack(stackTrace);
- }
-#endif
- return true;
- }
-#if DEBUG
- else
- {
- if (s_checkNetworkPacketRetryStacks)
- {
- _lastStack = stackTrace;
- }
- }
-#endif
- }
-
- // previous buffer is in snapshot
- _inBuff = new byte[_inBuff.Length];
- }
-
- if (_syncOverAsync)
- {
- ReadSniSyncOverAsync();
- return true;
- }
-
- ReadSni(new TaskCompletionSource