.Net Framework - Microsoft.Data.SqlClient trusted certificate error though not using that driver

Reuben Cohen 5 Reputation points
2025-05-16T15:39:06.8766667+00:00

This is a .NET Framework 4.8 console project, but there is no tag for that.

I am using Visual Studio 2022 - v17.10.1

When I try to add either an Entity Framework (v6.5.1) model from an existing SQL Server database, I get an error regarding a trusted certificate which most likely comes from Microsoft.Data.SqlClient - at least that's the where the exception comes from. I am using system.data.sqlclient though.

mdeISXiD

I am not using that driver at all for data access.

I tried adding TrustServerCertificate=true and Encrypt=False to the connection string, but that didn't make a difference because the program still connects to the database fine. I only have an issue when I try to add an Entity Framework Model.

Please note that the connection string I'm using to create the model is validating.

It almost looks like TrustServerCertificate=True is left off when creating the info in the app.config for the model.

Why would the connection string work, but creating the model not work?

Community Center | Not monitored
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Reuben Cohen 5 Reputation points
    2025-05-16T15:55:20.5666667+00:00

    This looks like it was caused by an incompatibility with EF Core Power Tools. As I also use Database First in EF Core, that is a necessary extension to provide functionality Microsoft removed.

    Disabling the extension seems to have fixed the issue. I may contact the extension's authors about this.

    0 comments No comments

  2. Pradeep M 9,875 Reputation points Microsoft External Staff Moderator
    2025-05-19T03:24:44.5566667+00:00

    Hi Reuben Cohen

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer. 

    Ask:.Net Framework - Microsoft.Data.SqlClient trusted certificate error though not using that driver. 

    Solution: The issue was caused by an incompatibility with EF Core Power Tools, which I use for Database First support in EF Core. Disabling the extension resolved the problem. 

    If you have any other questions, please let me know. Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members. 


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.