Path: redb/redb.SQLite/Data/SqliteNativeExtension.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.SQLite/Data/SqliteNativeExtension.cs
----
using System;
namespace redb.SQLite.Data
{
///
/// The version gate of the native extension: the loaded redbsqlite library must report the version the
/// dialect requires (pvt_module_version()), as the PostgreSQL and SQL Server modules must. A stale build
/// next to the application loaded silently and answered in an old shape - list item JSON in the old form, a regex
/// filter failing with an unrelated error.
///
public static class SqliteNativeExtension
{
///
/// Throws when - what the loaded extension reports, null when it has no
/// pvt_module_version() - is not .
///
public static void EnsureVersion(string path, string? deployed, string required)
{
if (string.Equals(deployed, required, StringComparison.Ordinal))
return;
var found = deployed == null
? "has no pvt_module_version() function"
: $"reports version {deployed}";
throw new InvalidOperationException(
$"The redb native SQLite extension '{path}' {found}; this build of redb.SQLite requires version " +
$"{required}. The library is built from redb.SQLite/native and ships with the package: update the " +
"package, or rebuild the extension (redb.SQLite/native/README.md) and replace the file next to the " +
"application.");
}
}
}