Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,19 @@ static LocalAppContextSwitches()
/// <summary>
/// In TdsParser the ProcessSni function changed significantly when the packet
/// multiplexing code needed for high speed multi-packet column values was added.
/// In case of compatibility problems this switch will change TdsParser to use
/// the previous version of the function.
/// The switch is enabled by default and retains the old ProcessSni design.
/// Use this switch to enable experimental design that uses the new ProcessSni
/// behavior using the packet multiplexer.
/// </summary>
public static bool UseCompatibilityProcessSni
{
get
{
if (s_useCompatibilityProcessSni == Tristate.NotInitialized)
{
if (AppContext.TryGetSwitch(UseCompatibilityProcessSniString, out bool returnedValue) && returnedValue)
// Check if the switch has been set by the AppContext switch directly
// If it has not been set, we default to true.
if (!AppContext.TryGetSwitch(UseCompatibilityProcessSniString, out bool returnedValue) || returnedValue)
{
s_useCompatibilityProcessSni = Tristate.True;
}
Expand All @@ -95,7 +98,7 @@ public static bool UseCompatibilityProcessSni
/// In TdsParser the async multi-packet column value fetch behaviour is capable of
/// using a continue snapshot state in addition to the original replay from start
/// logic.
/// This switch disables use of the continue snapshot state. This switch will always
/// This switch disables use of the continue snapshot state and is enabled by default. This switch will always
/// return true if <see cref="UseCompatibilityProcessSni"/> is enabled because the
/// continue state is not stable without the multiplexer.
/// </summary>
Expand All @@ -114,7 +117,7 @@ public static bool UseCompatibilityAsyncBehaviour

if (s_useCompatibilityAsyncBehaviour == Tristate.NotInitialized)
{
if (AppContext.TryGetSwitch(UseCompatibilityAsyncBehaviourString, out bool returnedValue) && returnedValue)
if (!AppContext.TryGetSwitch(UseCompatibilityAsyncBehaviourString, out bool returnedValue) || returnedValue)
{
s_useCompatibilityAsyncBehaviour = Tristate.True;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static bool IsUsingCompatibilityProcessSni
{
return foundValue;
}
return false;
return true; // Default to true if the switch is not set
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public void TestDefaultAppContextSwitchValues()
Assert.False(LocalAppContextSwitches.MakeReadAsyncBlocking);
Assert.True(LocalAppContextSwitches.UseMinimumLoginTimeout);
Assert.True(LocalAppContextSwitches.LegacyVarTimeZeroScaleBehaviour);
Assert.False(LocalAppContextSwitches.UseCompatibilityProcessSni);
Assert.False(LocalAppContextSwitches.UseCompatibilityAsyncBehaviour);
Assert.True(LocalAppContextSwitches.UseCompatibilityProcessSni);
Assert.True(LocalAppContextSwitches.UseCompatibilityAsyncBehaviour);
Assert.False(LocalAppContextSwitches.UseConnectionPoolV2);
Assert.False(LocalAppContextSwitches.TruncateScaledDecimal);
#if NETFRAMEWORK
Expand Down
Loading