sokolik745
sokolik745

Reputation: 21

Unable to load mod_spatialite extension into sqlite connection on .NET 7 (win)

I am trying to load spatialite to sqlite connection (in memory db) and it is failing with strange error without any message: Microsoft.Data.Sqlite.SqliteException: 'SQLite Error 1: ''.'

I isolated the problem to this short console app example:

using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore.Infrastructure;

var connection = new SqliteConnection("DataSource=:memory:");
connection.Open();
connection.EnableExtensions();

SpatialiteLoader.Load(connection);

Console.ReadKey();

Project file looks like this:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.2" />
  </ItemGroup>

</Project>

Downgrade of packages did not help. I tried the workaround mentioned here but I am not able to get it work.

Upvotes: 1

Views: 206

Answers (0)

Related Questions