Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.44k stars 68 forks source link

Trusted certificate issue when package installed but not used #58

Closed rer145 closed 1 year ago

rer145 commented 1 year ago

Once I installed the package (SqlServer) to my .NET 6 API project and added the call to UseExceptionProcessor() when configuring my DbContext, I ran into an issue with my connection, saying:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)

Adding the TrustServerCertificate=True to my connection string solved the issue.

However, when I commented out the UseExceptionProcessor() call and removed the TrustServerCertificate=True portion from the connection string, the error still occurred.

Only once I uninstalled the package from the project did it resolve itself. What all is the package doing when installed but not setup to run? Shouldn't it not be doing anything differently?

Giorgi commented 1 year ago

This looks related to https://github.com/Giorgi/EntityFramework.Exceptions/issues/49. Installing the EntityFrameworkCore.Exceptions.SqlServer package increases Microsoft.Data.SqlClient version to 4.0 and that version has some breaking changes about Sql Server connection encryption behavior.

rer145 commented 1 year ago

My apologies, I did not see that one in my (admittedly) quick search.