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

Microsoft.Data.SqlClient epic #1490

Open
jzabroski opened this issue Jun 16, 2021 · 3 comments
Open

Microsoft.Data.SqlClient epic #1490

jzabroski opened this issue Jun 16, 2021 · 3 comments
Labels

Comments

@jzabroski
Copy link
Collaborator

It seems like the 3.2.16 release decision to move to Microsoft.Data.SqlClient may have been a regretful one. Initially it was only Mono users impacted by this problem, but now it appears to be more general.

#1483 -- @arhughes
#1486 -- @m4rkyx

It works but there seems to be some kind of locking of the dll for Microsoft.Data.SqlClient.SNI.
Example. I have an ASP.NET MVC 5 site which also runs migrations using FluentMigrator, hosting it in IIS and rebuilding the solution fails because the dll is locked by the IIS process.
using (var scope = ServiceProvider.CreateScope()) doesn't seem to help with releasing resources.

-- @YanerTavuz #1023 (comment)

@PeterBenko
Copy link

Do the regrets have something to do with this issue or are they unrelated?

@jzabroski
Copy link
Collaborator Author

Do the regrets have something to do with this issue or are they unrelated?

Interesting. @mattbrailsford I wonder if the SNI issue with SQLite is related to this issue?

@PeterBenko Matt had to manually include the SQLite native interface package in his recent PR.

@jzabroski
Copy link
Collaborator Author

@PeterBenko I think I found the root cause, which wasn't really articulated in that issue you linked, but hinted at:

It looks like this document explains it: https://docs.microsoft.com/en-us/sql/connect/ado-net/sqlclient-troubleshooting-guide?view=sql-server-ver15

Unable to load native SNI (Server Name Indication) library

SNI is the native C++ library that SqlClient depends on for various network operations when running on Windows. In .NET Framework applications that are built with the MSBuild Project SDK, native DLLs aren't managed with restore commands. So a ".targets" file is included in the "Microsoft.Data.SqlClient.SNI" NuGet package that defines the necessary "Copy" operations.

Our tests run on net461:

https://github.com/fluentmigrator/fluentmigrator/blob/master/test/FluentMigrator.Tests/FluentMigrator.Tests.csproj#L3

I believe @mattbrailsford ran into a similar issue, and his fix was to force a PackageReference to the package containing the missing dll.

https://github.com/fluentmigrator/fluentmigrator/blame/e383dda6cce65903a67b1bbc254c596d066a872c/test/FluentMigrator.Tests/FluentMigrator.Tests.csproj#L34

Note, it seems nuget restore for legacy .NET Framework can restore these native dlls, it just can't do it as a transitive reference, apparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants