Skip to content

Attempted to divide by zero.” #132

Description

@mzy666888

Package version

5.0.4

Affected package

BLite (client SDK)

.NET version

10.0.10

Description

Attempted to divide by zero.

Minimal reproduction

internal class Program
{
    static void Main(string[] args)
    {
        using var context = new ConfigDbContext("my.db");
        Console.WriteLine("Hello, World!");
    }
}

public sealed partial class ConfigDbContext : BLite.Core.DocumentDbContext
{
    public ConfigDbContext(string databasePath) : base(databasePath, new PageFileConfig { AllowMultiProcessAccess = true })
    {
        InitializeCollections();
    }

    public DocumentCollection<ObjectId, User> CommParameters { get; set; }
}

public class User
{
    public ObjectId Id { get; set; }
    public string Name { get; set; }
    public int Age { get; set; }
}

Expected behavior

don't throw exception

Actual behavior

   在 BLite.Core.Storage.PageFile.AlignToBlock(Int64 requiredLength)
   在 BLite.Core.Storage.PageFile.Open()
   在 BLite.Core.Storage.StorageEngine..ctor(String databasePath, PageFileConfig config)
   在 BLite.Core.DocumentDbContext..ctor(String databasePath, PageFileConfig config, BLiteKvOptions kvOptions)
   在 BLite.Core.DocumentDbContext..ctor(String databasePath, PageFileConfig config)
   在 ConsoleApp1.ConfigDbContext..ctor(String databasePath) 在 D:\Visual Studio 2026\ConsoleApp1\ConsoleApp1\Program.cs 中: 第 25 行
   在 ConsoleApp1.Program.Main(St

Additional context

windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpackage/clientAffects BLite client SDKtriage

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions