Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db.db-shm and db.db-wal cannot be cleaned up automatically #26845

Closed
84819760 opened this issue Nov 29, 2021 · 2 comments
Closed

Db.db-shm and db.db-wal cannot be cleaned up automatically #26845

84819760 opened this issue Nov 29, 2021 · 2 comments

Comments

@84819760
Copy link

class

public class Table1
{
    public long Id { get; set; }

    public string? Value { get; set; }
}

public class DbContext : Microsoft.EntityFrameworkCore.DbContext
{
    public DbSet<Table1>? Tables { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var conn = new SqliteConnectionStringBuilder()
        {
            DataSource = @"D:\tmp\EF6.db",
        };
        optionsBuilder.UseSqlite(conn.ToString());
    }
}

Program.cs

using var db = new DbContext();
using var bt = db.Database.BeginTransaction();
Enumerable.Range(0, 10000)
    .Select(i => new Table1 { Value = i.ToString() })
    .ToList()
    .ForEach(item => db.Add(item));
await bt.CommitAsync();
await db.SaveChangesAsync();

The above code can be executed normally in entityframeworkcore5, and ef6.db-shm and ef6.db-wal can be cleaned up automatically.

After upgrading entityframeworkcore6, a write data exception will occur. Data will only be written to ef6.db-wal. There is no data in ef6.db, and ef6.db-shm and ef6.db-wal will not be cleaned up automatically. This phenomenon also occurs when PM> Update-Databaseis executed.

EF Core version:
Database provider: (e.g. Microsoft.EntityFrameworkCore.Sqlite 6.0.0)
Target framework: (e.g. .NET 6.0)
Operating system:
IDE: (e.g. Visual Studio 2022 17.0.1)

@ajcvickers
Copy link
Contributor

Duplicate of #26422.

@84819760
Copy link
Author

复本#26422.

Thank you.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants