SqlConnection instantiation exception on .NET 4.6 and later after August-September 2018 .NET Framework updates

Applies to: .NET Framework 4.6Microsoft .NET Framework 4.7

Symptoms


After you install the August Preview of Quality Rollup or September 11, 2018, .NET Framework update, instantiation of SqlConnection can throw an exception.

Use of a SqlConnection constructor can lead to a stack trace that resembles the following:

Workaround


Workaround 1

Add the following lines in the configSection of the App.Config file of the application:

<section name="SqlColumnEncryptionEnclaveProviders"
type="System.Data.SqlClient.SqlColumnEncryptionEnclaveProviderConfigurationSection,
System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

Note If your application doesn't include an app.config file, we recommend that you create and deploy an app.config file that contains this information in the configSection.

If Workaround 1 doesn't work, try Workaround 2.

Workaround 2

Identify a place in the app domain that runs before any objects have been added to the logical call context. Add code to force ConfigurationManager to try to load a section that doesn't exist in any configuration files. For example:

System.Configuration.ConfigurationManager.GetSection("SectionNameThatDoesNotExistInAnyConfigurationFile");

For more information about this issue see the GitHub article Mitigation: Deserialization of objects across app domains.

Status


Microsoft is researching this issue and will provide an update in an upcoming release.