-
Notifications
You must be signed in to change notification settings - Fork 285
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
Fix access violation when using Express user instances #2101
Conversation
This occurs due to hostNameInCertificate being set to null. This is called from SQLConnectionFactory.cs#98
A test would be nice.. |
I would like to add some, but it seems difficult to do comprehensively. The local instances feature is currently completely untested, and it seems the closest public interface up the call stack is basically If you think it's enough, I can add a test amounting to Assert.Throws<SqlException>(() => connection.Open()); // hey, at least it doesn't throw an access violation anymore! but that would not really add any guarantee of the feature working in the future - just that this one very specific issue doesn't occur. As for integration tests, I am out of my depth there as to how they work in this project but I don't think any of the test pipelines run against Express, which is the only thing that supports this feature |
Yeah, anything is better than no test at all, IMHO. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2101 +/- ##
==========================================
+ Coverage 69.97% 70.08% +0.11%
==========================================
Files 306 306
Lines 61975 61976 +1
==========================================
+ Hits 43368 43437 +69
+ Misses 18607 18539 -68
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@dotnet-policy-service agree |
…r instances (dotnet#2101) Ports [dotnet#2101](dotnet#2101)
Fixes #1944
When SQL Server Express user instances are used, this constructor is called from a special code path at SQLConnectionFactory.cs#L98.
Because the _hostNameInCertificate option is not set in the constructor, the cloned connection at line 99 fails with an access violation somewhere on the native side.
Releases after PR #1608 (which initially added this option) are affected - Express user instances won't work at all in any of them.