dotnet / dotnet/efcore

Make Microsoft.Data.Sqlite unloadable

Open
#27,498 4 comments 0 reactions 0 assignees View on GitHub
area-adonet-sqlite customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Description:
Unable to unload AssemblyLoadContext after creating a Microsoft.Data.Sqlite.SqliteConnection

Reproduction Steps:
1. Take the unloading solution from https://github.com/dotnet/samples/tree/main/core/tutorials/Unloading
2. Upgrade the solution targeting Net6.0
3. Add EnableDynamicLoading at true in Plugin.csproj
4. Implement LoadUnmanagedDll to HostAssemblyLoadContext
5. Add nuget reference to Microsoft.Data.Sqlite 6.0.2 in project Plugin
6. In PluginClass constructor add: using var connection = new Microsoft.Data.Sqlite.SqliteConnection();
7. All those steps are already implemented in zipped project

[Unloading_MicrosoftDataSqlite.zip](https://github.com/dotnet/efcore/files/8125956/Unloading_MicrosoftDataSqlite.zip)

Microsoft.Data.Sqlite version: 6.0.2
Target framework: Net 6.0
Operating system: Windows 10

Could be related with https://github.com/dotnet/runtime/issues/65781

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.