Skip to content

[BUG] - FormatException when inserting documents with duplicate keys #2

Description

@thanh-synaptive

Version
4.1.2

Describe the bug
When inserting a document with a key which already exists, instead of throwing LiteException with with ErrorCode = INDEX_DUPLICATE_KEY, LiteDB throws FormatException.

Additional context

  1. This is similar to System.FormatException: Input string was not in a correct format litedb-org/LiteDB#1115
  2. It could lead to data corruption because the transaction may not be rolled back properly!
  3. It seems the exception happens if a logger is used:

https://github.com/SynaptiveMedical/LiteDB/blob/synaptive/v4.1.2/LiteDB/Engine/LiteEngine.cs#L210
https://github.com/SynaptiveMedical/LiteDB/blob/synaptive/v4.1.2/LiteDB/Utils/Logger.cs#L69

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions