Open cheenamalhotra opened 1 year ago
Hi @cheenamalhotra, I agree, we should have more meaningful exceptions for TDS8 due to the unsupported encryption type for Strict mode on versions prior to Sql Server 2022 as well as the misconfiguration of the certificate as I was also something I noticed when writing the tests in https://github.com/dotnet/SqlClient/pull/1891 , but I'll bring it up to the team and discuss if it's something that we can add in a hotfix in Native SNI or catch in MDS to rethrowing a meaningful exception. I'll get back to you soon.
Describe the bug
With 'Strict' encryption is requested, error messages don't provide useful information to what went wrong.
When connecting to a SQL Server 2019 instance that doesn't support 'Encrypt=Strict'
When connecting to a SQL Server 2022 instance that is not configured with TLS certificate, but 'Strict' encryption is requested.
Expected behavior
Throw an appropriate error message - as it can be identified from connection properties that user requested 'Strict' encryption and an SSL provider related error has occurred.
Further technical details
Microsoft.Data.SqlClient version: 5.0.1 .NET target: .NET 6 SQL Server version: SQL 2019, 2022 Operating system: Windows 11 (Native SNI)
Additional Context
I haven't tested Managed SNI yet, but that should be fixed to provide correct error messages too.