Skip to content

Commit c6fa6bd

Browse files
Do not throw exception for invalid configuration file (#573)
1 parent df35d18 commit c6fa6bd

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.NetCoreApp.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ internal partial class SqlAuthenticationProviderManager
1616
static SqlAuthenticationProviderManager()
1717
{
1818
var activeDirectoryAuthNativeProvider = new ActiveDirectoryNativeAuthenticationProvider();
19-
SqlAuthenticationProviderConfigurationSection configurationSection;
19+
SqlAuthenticationProviderConfigurationSection configurationSection = null;
2020

2121
try
2222
{
2323
configurationSection = (SqlAuthenticationProviderConfigurationSection)ConfigurationManager.GetSection(SqlAuthenticationProviderConfigurationSection.Name);
2424
}
25-
catch (ConfigurationErrorsException e)
25+
catch (ConfigurationErrorsException)
2626
{
27-
throw SQL.CannotGetAuthProviderConfig(e);
27+
// Don't throw an error for invalid config files
2828
}
2929

3030
Instance = new SqlAuthenticationProviderManager(configurationSection);

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System;
66
using System.Collections.Concurrent;
77
using System.Collections.Generic;
8-
using System.Configuration;
98
using System.Linq;
109

1110
namespace Microsoft.Data.SqlClient

0 commit comments

Comments
 (0)