From de61e91307901c79367baa638e3f24264fbd7748 Mon Sep 17 00:00:00 2001 From: sven-n Date: Sat, 7 Sep 2024 14:33:29 +0200 Subject: [PATCH] Fixed exception when adding an item to a InMemoryContext when it already exists Happens after a trade. --- src/Persistence/InMemory/MemoryRepository{TValue}.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Persistence/InMemory/MemoryRepository{TValue}.cs b/src/Persistence/InMemory/MemoryRepository{TValue}.cs index 9558464d2..fc28fc222 100644 --- a/src/Persistence/InMemory/MemoryRepository{TValue}.cs +++ b/src/Persistence/InMemory/MemoryRepository{TValue}.cs @@ -24,7 +24,7 @@ public class MemoryRepository : IRepository, IMemoryRepository /// The item. public void Add(Guid key, TValue obj) { - this._values.Add(key, obj); + this._values.TryAdd(key, obj); this._createdObjects.Add(key); }