Skip to content

v3.0.3

Choose a tag to compare

@github-actions github-actions released this 15 Aug 15:10
· 2 commits to master since this release

Warning

Resolve-ImageStoreSimilarFiles in this release fails with "Unable to cast object of type 'System.Double' to type 'System.Single'."
Use v3.0.4.

Fixes the module failing to load. If you hit this in v3.0.2, upgrade:

Open-ImageStoreDatabase: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.

What was wrong

Import-Module loads a module assembly directly rather than starting an application, so the RID-specific probing that finds runtimes\<rid>\native never runs — that step is driven by deps.json when a host starts an app, and there is no such step here. The P/Invoke inside SQLitePCLRaw searched only the ordinary OS paths, did not find e_sqlite3.dll, and the failure surfaced as a type-initializer error that says nothing about a missing file.

The engine is now loaded explicitly when the module is imported, choosing the directory by process architecture, so x64, x86 and arm64 hosts all work.

Also fixed

Set-ImageStoreThumbprintCacheFolder resolved its path against AppContext.BaseDirectory, which for a module is the host's directory — the cache would have been created next to pwsh.exe instead of beside the module. Introduced in v2.0 during the .NET 10 upgrade, when Assembly.CodeBase was replaced. Both call sites now resolve from the module's own location.

Workaround for v3.0.2

Copying the engine beside the module also works, if you would rather not upgrade:

Copy-Item .\runtimes\win-x64\native\e_sqlite3.dll .