dotnet / dotnet/EntityFramework.Docs

Note SpatiaLite stability issues in docs

Open
#3,277 8 comments 0 reactions 0 assignees View on GitHub
area-spatial area-sqlite
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

Good morning,

we are not able to include our tests suite on the CI process using Docker (Ubuntu 20.04). It seems that there is an issue with SQLite with NetTopologySuite. Locally on Windows 10 with Visual Studio 2019 tests are executed with no issue.
```C#
public abstract class TestDbContext : IDisposable
{
private const string InMemoryConnectionString = "DataSource=:memory:";
private readonly SqliteConnection _connection;

protected readonly MyContext DbContext;

protected TestDbContext()
{
_connection = new SqliteConnection(InMemoryConnectionString);
_connection.Open();

var options = new DbContextOptionsBuilder()
.UseSqlite(_connection, x => x.UseNetTopologySuite())
.Options;
DbContext = new MyContext(options);
DbContext.Database.EnsureCreated();

InitData();
}

private void InitData()
{
//Add some data in order to make tests
}

public void Dispose() => _connection.Close();
}
```

```C#
public class SpvTests : TestDbContext
{
[Fact]
public async void Test1()
{
Assert.False(DbContext.Database.EnsureCreated());
}
}
```

```C#
FROM mcr.microsoft.com/dotnet/sdk:5.0-focal
WORKDIR /src
COPY ["MyProject.Tests/MyProject.Tests.csproj", "MyProject.Tests/"]
COPY ["MyProject/MyProject.csproj", "MyProject/"]
COPY ["MyProject.Data/MyProject.Data.csproj", "MyProject.Data/"]

RUN apt update && apt install libsqlite3-dev libsqlite3-mod-spatialite -y

RUN dotnet restore "MyProject.Tests/MyProject.Tests.csproj"

COPY . .
WORKDIR "/src/MyProject.Tests"

ENTRYPOINT ["dotnet", "test"]
```

### Include stack traces

Include the full exception message and stack trace for any exception you encounter.

Use triple-tick fences for stack traces. For example:

```
Microsoft (R) Test Execution Command Line Tool Version 16.9.4
Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 5.0.6)
[xUnit.net 00:00:00.85] Discovering: MyProject.Tests
[xUnit.net 00:00:00.89] Discovered: MyProject.Tests
[xUnit.net 00:00:00.89] Starting: MyProject.Tests
The active test run was aborted. Reason: Test host process crashed

Test Run Aborted.
1>Done Building Project "/src/MyProject.Tests/MyProject.Tests.csproj" (VSTest target(s)) -- FAILED.

Build FAILED.
0 Warning(s)
0 Error(s)
```

### Include version information

```xml


net5.0

false

Linux








runtime; build; native; contentfiles; analyzers; buildtransitive
all


runtime; build; native; contentfiles; analyzers; buildtransitive
all



```

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.