[x] This is not a duplicate of an existing merge request.
[x] I believe this falls into the scope of the project and should be part of the built-in functionality.
[x] My code follows the code style of this project.
[x] I have added tests to cover my changes, wherever they are necessary.
[x] All new and existing tests pass.
Changes
New functionality
None
Changed functionality
None
Removed functionality
None
Additional info
Fixes an exception I've been seeing in 6.0.1.3 and 6.0.1.4 when trading between bots. On seemingly random trades, the same item will appear multiple times in the trade description, producing this error and blocking the trades from being accepted by ASF:
2024-03-18 20:15:46|ArchiSteamFarm-3412129|FATAL|ASF|OnUnobservedTaskException() System.ArgumentException: An item with the same key has already been added. Key: (753, 2320557464, 0)
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
at ArchiSteamFarm.Steam.Integration.ArchiWebHandler.GetTradeOffers(Nullable`1 activeOnly, Nullable`1 receivedOffers, Nullable`1 sentOffers, Nullable`1 withDescriptions) in /ArchiSteamFarm/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs:line 505
at ArchiSteamFarm.Steam.Exchange.Trading.ParseActiveTrades() in /ArchiSteamFarm/ArchiSteamFarm/Steam/Exchange/Trading.cs:line 263
at ArchiSteamFarm.Steam.Exchange.Trading.OnNewTrade() in /ArchiSteamFarm/ArchiSteamFarm/Steam/Exchange/Trading.cs:line 231
Checklist
Changes
New functionality
None
Changed functionality
None
Removed functionality
None
Additional info
Fixes an exception I've been seeing in 6.0.1.3 and 6.0.1.4 when trading between bots. On seemingly random trades, the same item will appear multiple times in the trade description, producing this error and blocking the trades from being accepted by ASF:
If you'd like to see the response from https://api.steampowered.com/IEconService/GetTradeOffers that produces this error I can provide it.