Skip to content

Db file locking read errors / Italian UI prompts #124

Description

@ps30

Package version

5.0.0

Affected package

BLite (client SDK)

.NET version

10.0

Description

Consistent file read errors when trying to use the single database file even in read-only mode.

Following the sample documentation on and using Blite Studio to open the sample database myapp.blite results in "System.IO.IOException: 'The process cannot access the file 'C:...\repos\MyApp\bin\Debug\net10.0\myapp.blite' because it is being used by another process.' from the sample app code. The same problem is found when attempting to open the myapp.blite file from BLite Studio even in read-only mode.

Perhaps there is some problem with locking/unlocking the database but this should never happen on a single file database especially with read-only access needed from multiple applications (like BLite Studio). Multiple different applications should be able to read data from the database without blocking.

Image

The current published version of BLite Studio for Windows x64 is generating many UI prompts in Italian and not the system default language: github.com/EntglDb/BLite/releases/download/studio-v4.4.2/BLite.Studio-4.4.2-win-x64-portable.zip

Image Image

Minimal reproduction

    static async Task Main(string[] args)
    {
        using var db = new AppDbContext("myapp.blite");
        var users = db.Users;

        var newUser = new User
        {
            Name = "Alice",
            Age = 30,
            Email = "alice@example.com"
        };

        await users.InsertAsync(newUser);
        Console.WriteLine($"Inserted with ID: {newUser.Id}");

        // Find by ID
        var user = await users.FindByIdAsync(newUser.Id, CancellationToken.None);
        Console.WriteLine($"Found user: {user?.Name}, Age: {user?.Age}");

        // Query with async LINQ
        List<User> results = await users.AsQueryable().Where(u => u.Age > 25).ToListAsync(CancellationToken.None);
        foreach (var u in results)
        {
            Console.WriteLine($"User: {u.Name}, Age: {u.Age}");
        }
    }

Expected behavior

Should be able to read the database from multiple sources with correct locking/sharing.

Actual behavior

Example database file myapp.blite locked even for read-only access. Using all demo/sample code from BLite website.

Additional context

No response

Activity

  1. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    👋 Thanks for the well-formed bug report! It has been added to the triage queue.

  2. moved this from Todo to In Progress in BLiteon Jun 6, 2026
  3. moved this from In Progress to Done in BLiteon Jun 6, 2026
  4. ps30 commented on Jun 7, 2026

    @ps30
    Author

    Hello we tested and still there are problems with 5.0.1:

    File locking is not working in 5.0.1 with the same problems opening myapp.blite running the demo code from the website and then opening the myapp.blite file read-only from BLite Studio produces this error:
    Image

    There are still Italian language prompts in the UI for BLite Studio 5.0.1 and the version display is wrong 5.0.0 should be 5.0.1:
    Image

  5. moved this from Done to In Progress in BLiteon Jun 8, 2026
  6. github-actions commented on Jun 8, 2026

    @github-actions
    Contributor

    👋 Thanks for the well-formed bug report! It has been added to the triage queue.

  7. mrdevrobot commented on Jun 8, 2026

    @mrdevrobot
    Contributor

    Hi @ps30 please check that your application is opening the database file with sharing enabled (which is not the default) this should allow other threads to access the file as well.

    I'm checking alla remaining Italian phrases, sorry for that, we'll fix it asap.

  8. added theissue type on Jun 8, 2026
  9. ps30 commented on Jun 9, 2026

    @ps30
    Author

    Hi could you please share how to modify the example/sample code you provided on your website to allow Blite Studio to open the database file in read-only mode for viewing? Maybe we are missing something simple here, but you should be able to run the demo C# BLite code that creates user records into the BLite database file and then concurrently use Blite Studio to open in read-only mode and view those records as they are added to the file. Currently we are getting errors that "another process is using the file" this is from System.IO so it seems to be a file locking problem (see screen shot below). Have you been able to reproduce this, or is there any config of the AppDbContext : DocumentDbContext that does not lock the database file to single process use.

    Image
  10. mrdevrobot commented on Jun 9, 2026

    @mrdevrobot
    Contributor
  11. ps30 commented on Jun 10, 2026

    @ps30
    Author

    I think we may have found part of the problem. When BLite Studio attempts to open a database file (example myapp.blite) it creates a file myapp.wal-shm even when failing to open "Error: Access to the path is denied". When closing Blite Studio this file *-shm is not cleaned up/deleted and stays in the directory. Could this be an issue?

    Image

    Questions:

    1. What is the best method to delete all records in a collection? users.TruncateAsync();
    2. Do you plan to add a built in UpsertAsync method?
    3. If the repo had a simple CRUD demo console app with best practices using Blite that would be very helpful.

    Thank you as we learn to use your db!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingpackage/clientAffects BLite client SDK

Type

Projects

  • Status
    In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions