-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[BUG] Deleting a non existing collection causes insert operation to fail #1795
Comments
@alierdogan70 I could not reproduce the issue running LiteDB v5.0.8 on .NET Core v3.1.4. Also, if I understood you correctly, you claim to be using .NET Framework 4.0, which I believe is not possible for two reasons:
|
@alierdogan70 I still haven't been able to reproduce the issue. I'm running on .NET Framework 4.7.2 and I tried running both in debug and in release mode. The log file is meant to disappear when the Try calling |
Hi @lbnascimento , I created a small application containing the bug. Please delete the database file before every try. If you uncomment AddressRepository.cs line 95 it works properly. I hope this helps |
@alierdogan70 This seems to be related to #1762, and your app finally allowed me to reproduce it and to fix it, so thanks for that. Just to make sure, could you test with the latest master? |
@lbnascimento I am having the same problem although I tried with latest master. using var db = new LiteDatabase(new ConnectionString
{
Filename = "C:\\testing\\taskdb.ld",
Password = "xxx",
Connection = ConnectionType.Shared,
ReadOnly = false
});
var collection = db.GetCollection<BasicGuidValue>("task_guid");
Guid taskMainGuid = Guid.Parse("ac2b28f7-bce7-441c-adbb-7f3e62c89c5c");
var guidBasic = new BasicGuidValue(taskMainGuid);
collection.DeleteAll();
collection.Insert(guidBasic);
// BasicGuidValue obj ->
public class BasicGuidValue
{
[JsonConstructor]
[BsonCtor]
public BasicGuidValue(Guid value)
{
Value = value;
}
public Guid Value { get; set; }
} After the code runs, the collection is not created in the database (If not exists). -- Same problem, different delete strategy; using var db = new LiteDatabase(new ConnectionString
{
Filename = "C:\\testing\\taskdb.ld",
Password = "xxx",
Connection = ConnectionType.Shared,
ReadOnly = false
});
db.DropCollection("task_guid");
var collection = db.GetCollection<BasicGuidValue>("task_guid");
Guid taskMainGuid = Guid.Parse("ac2b28f7-bce7-441c-adbb-7f3e62c89c5c");
var guidBasic = new BasicGuidValue(taskMainGuid);
collection.Insert(guidBasic); Still not creating the collection. |
@alierdogan70 I could not reproduce the issue on .NET Core 3.1. I'm not currently able to test on .NET 5 (I may be in a few days). Is there any way you could test it with .NET Core 3.1? |
Hi. I am out of town for 3 weeks. I am going to try when I return back. |
Version
LiteDb 5.0.8.0
.net RunTime v4.0.30319
VS 2019
Windows Forms Application
Describe the bug
Deleting a non existing collection causes insert operation to fail. InsertBulk returns successful result but data do not get inserted to the database.
Usage
Expected behavior
Data to be inserted. Insertbulk method returns correct number although data is not inserted.
Additional context
It works as expected when you change delete method as :
The text was updated successfully, but these errors were encountered: