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:

 System.Runtime.Serialization.SerializationException    at System.AppDomain.get_Evidence()    at System.AppDomain.get_Evidence()    at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)    at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)    at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)    at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)    at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)    at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)    at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)    at System.Configuration.ConfigurationManager.GetSection(String sectionName)    at System.Data.SqlClient.SqlConnection..cctor()

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.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.