Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix access violation when using Express user instances #2101

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ internal SqlConnectionString(SqlConnectionString connectionOptions, string dataS
_attestationProtocol = connectionOptions._attestationProtocol;
_serverSPN = connectionOptions._serverSPN;
_failoverPartnerSPN = connectionOptions._failoverPartnerSPN;
_hostNameInCertificate = connectionOptions._hostNameInCertificate;
#if NETFRAMEWORK
_connectionReset = connectionOptions._connectionReset;
_contextConnection = connectionOptions._contextConnection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,15 @@ public void Open_ConnectionString_Whitespace()
Assert.NotNull(ex.Message);
}

[Fact]
public void Open_ConnectionString_UserInstance()
{
SqlConnection cn = new SqlConnection("User Instance=true;");
SqlException ex = Assert.Throws<SqlException>(() => cn.Open());
// Throws without access violation
Assert.NotNull(ex.Message);
}

[Fact]
public void ServerVersion_Connection_Closed()
{
Expand Down