babelshift/SteamWebAPI2

Error When Using GetOwnedGames on MacOS

alexp9982 opened this issue · 2 comments

When using MacOS (On Windows, the exact code works just fine), when attempting to use the GetOwnedGamesAsync method, the method fails and shoots an AutoMapper error. Here is the error stack:

AutoMapper.AutoMapperMappingException: Error mapping types.

Mapping types:
OwnedGamesResult -> OwnedGamesResultModel
SteamWebAPI2.Models.SteamPlayer.OwnedGamesResult -> Steam.Models.SteamCommunity.OwnedGamesResultModel

Type Map configuration:
OwnedGamesResult -> OwnedGamesResultModel
SteamWebAPI2.Models.SteamPlayer.OwnedGamesResult -> Steam.Models.SteamCommunity.OwnedGamesResultModel

Destination Member:
OwnedGames

 ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator[[SteamWebAPI2.Models.SteamPlayer.OwnedGame, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]].MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator[[SteamWebAPI2.Models.SteamPlayer.OwnedGame, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at System.Linq.Expressions.Interpreter.FuncCallInstruction`2[[System.Collections.IEnumerator, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Boolean, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   --- End of inner exception stack trace ---
   at System.Linq.Expressions.Interpreter.ThrowInstruction.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)
   at SteamWebAPI2.Mappings.PlayerServiceProfile.<>c.<.ctor>b__0_8(OwnedGamesResultContainer src, OwnedGamesResultModel dest, ResolutionContext context)
   at System.Linq.Expressions.Interpreter.FuncCallInstruction`5[[System.Func`4[[SteamWebAPI2.Models.SteamPlayer.OwnedGamesResultContainer, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AutoMapper.ResolutionContext, AutoMapper, Version=11.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005],[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SteamWebAPI2.Models.SteamPlayer.OwnedGamesResultContainer, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[AutoMapper.ResolutionContext, AutoMapper, Version=11.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005],[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)
   at SteamWebAPI2.Mappings.SteamWebResponseProfile.ConstructSteamWebResponse[OwnedGamesResultContainer,OwnedGamesResultModel](ISteamWebResponse`1 response, ResolutionContext context)
   at SteamWebAPI2.Mappings.SteamWebResponseProfile.<CreateSteamWebResponseMap>b__2_0[OwnedGamesResultContainer,OwnedGamesResultModel](ISteamWebResponse`1 src, ISteamWebResponse`1 dest, ResolutionContext context)
   at System.Linq.Expressions.Interpreter.FuncCallInstruction`5[[System.Func`4[[SteamWebAPI2.Utilities.ISteamWebResponse`1[[SteamWebAPI2.Models.SteamPlayer.OwnedGamesResultContainer, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[SteamWebAPI2.Utilities.ISteamWebResponse`1[[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[AutoMapper.ResolutionContext, AutoMapper, Version=11.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005],[SteamWebAPI2.Utilities.ISteamWebResponse`1[[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[SteamWebAPI2.Utilities.ISteamWebResponse`1[[SteamWebAPI2.Models.SteamPlayer.OwnedGamesResultContainer, SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[SteamWebAPI2.Utilities.ISteamWebResponse`1[[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null],[AutoMapper.ResolutionContext, AutoMapper, Version=11.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005],[SteamWebAPI2.Utilities.ISteamWebResponse`1[[Steam.Models.SteamCommunity.OwnedGamesResultModel, Steam.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], SteamWebAPI2, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null]].Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)
   at SteamWebAPI2.Interfaces.PlayerService.GetOwnedGamesAsync(UInt64 steamId, Nullable`1 includeAppInfo, Nullable`1 includeFreeGames, IReadOnlyCollection`1 appIdsToFilter)
   at SteamCompare.ViewModel.ListPageViewModel.GetResults() in /Users/alexp/Projects/SteamCompare/SteamCompare/ViewModel/ListPageViewModel.cs:line 101

The full source code is open source, and is available on my profile, or using the link here.

Is this issue possible to solve on your end or is this an AutoMapper problem?

What version of AutoMapper are you using?

At the time I had tried 10.1.1, 11.0.0, and 11.0.1