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

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

Open
thanh-synaptive opened this issue Jun 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@thanh-synaptive
Copy link

thanh-synaptive commented Jun 11, 2024

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 mbdavid/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

@thanh-synaptive thanh-synaptive added the bug Something isn't working label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant