Skip to content

Conversation

@cheenamalhotra
Copy link
Member

@cheenamalhotra cheenamalhotra commented Mar 20, 2020

Enabling preview of Managed SNI on Windows for testing and debugging purposes.

With this change, users will be able to specify the below AppContext switch to toggle driver's behavior to use Managed SNI in .NET Core 2.1+ and .NET Standard 2.0+ projects on Windows.

Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows

AppContext.SetSwitch("Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows", true);

EDIT: Starting in 2.0 Preview 3, the context switch name was standardized to: "Switch.Microsoft.Data.SqlClient.UseManagedNetworkingOnWindows".

[NOTE] Known differences when compared to Native SNI.dll:

  • Managed SNI does not support non-domain Windows Authentication.

@cheenamalhotra cheenamalhotra changed the title Enable Managed SNI on Windows with Environment Variable Enable Managed SNI on Windows with AppContext switch Mar 20, 2020
@cheenamalhotra cheenamalhotra added Area\Managed SNI Issues that are targeted to the Managed SNI codebase. Public API 🆕 Issues/PRs that introduce new APIs to the driver. labels Mar 20, 2020
@Wraith2
Copy link
Contributor

Wraith2 commented Mar 21, 2020

The environment variable option is useful both in debugging and some deployment scenarios like azure where recompiling may be difficult but the environment is mutable. Any change of keeping that option around?

@cheenamalhotra
Copy link
Member Author

@Wraith2 you can use Environment variable and use that in your app startup to Set App Context switch like I did in DataTestUtility class.

On discussion with Saurabh, we concluded 1 enabling option only with App Context switch as that's .NETs standardized approach to toggle optional/preview behaviours.

We shall be using more of these for future optional/preview features or toggle options for backwards compatibility.

@ErikEJ
Copy link
Contributor

ErikEJ commented Mar 22, 2020

If you are going to do that, it would be very useful to have them documented in a central location.

@Wraith2
Copy link
Contributor

Wraith2 commented Mar 23, 2020

Some random thoughts.

  • there should probably be a trace event for this so you can see what mode was chosen
  • it needs to be noted in the docs that the appcontext switch has to be set as early as possible and certainly before any queries are executed. This is because it's a static property and it's execution will be caused by whatever touches the class first which is dependent on the dependency graph inside the library. Making it Lazy would probably delay it a little but not much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Managed SNI Issues that are targeted to the Managed SNI codebase. Public API 🆕 Issues/PRs that introduce new APIs to the driver.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants