"Keyword Not Supported" and Certificate Trust Errors
Two different exceptions, thrown at two different points in the connection process, that both start showing up around the same time in a codebase: a "Keyword not supported" ArgumentException before a connection is even attempted, and "The certificate chain was issued by an authority that is not trusted" once one is. Both trace back to the same cause.
// "keyword not supported" — a library mismatch, not a typo
Microsoft.Data.SqlClient has been the Microsoft-recommended provider since System.Data.SqlClient was put into maintenance-only mode; if a project still references the old package anywhere, that's almost always the real fix, not stripping keywords out of the connection string.// the certificate error — a default that changed under you
Starting with Microsoft.Data.SqlClient 4.0, the Encrypt setting defaults to true (mandatory) — earlier versions, and the old System.Data.SqlClient, defaulted it to false. A connection string with no Encrypt keyword at all behaved identically for years, then started failing the moment a NuGet update pulled in 4.0 or later, because encryption is now attempted by default and the client validates the server's certificate as part of that.
Encrypt=True;TrustServerCertificate=TrueKeeps the connection encrypted, skips validating who signed the certificate. Reasonable for internal networks and local dev where you control both ends.Encrypt=FalseTurns encryption off entirely, reverting to the old default. Fine for a local database on localhost; avoid it for anything crossing a real network.// build it correctly the first time
The Connection String Builder sets Encrypt and TrustServerCertificate explicitly and flags the combinations that commonly cause exactly these two errors, so the string it produces doesn't depend on whichever default happens to ship in whatever package version gets restored next.
System.Data.SqlClient(the old, in-box provider) andMicrosoft.Data.SqlClient(the actively developed successor) don't recognize the same connection-string keywords. A handful of newer keywords —TrustServerCertificate,Column Encryption Setting,Attestation Protocol,Enclave Attestation Urlamong them — exist inMicrosoft.Data.SqlClientbut throwKeyword not supported: '…'if that exact same connection string reaches aSystem.Data.SqlClient.SqlConnectioninstead. This happens more often than it sounds: a connection string built with one provider'sSqlConnectionStringBuilderand handed to code still referencing the other, a partially completed migration between the two packages, or a copy-pasted connection string from a newer tutorial landing in an older project.