babelshift / SteamWebAPI2

🎮 C# / .NET library that makes it easy to use the Steam Web API. It conveniently wraps around all of the JSON data and ugly API details with clean methods, structures and classes.
MIT License
263 stars 43 forks source link

v4.3.2 not working with AutoMapper 11.0.0+ #127

Closed paoloposo closed 2 years ago

paoloposo commented 2 years ago

Hi, I was trying out this library and noticed that it doesn't work with AutoMapper v11.0.0 and upwards. Simply instantiating a SteamWebInterfaceFactory results in this error:

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.MissingMethodException: Method not found: 'Void AutoMapper.IMappingExpressionBase`3.ConvertUsing(System.Linq.Expressions.Expression`1<System.Func`2<!0,!1>>)'.
   at SteamWebAPI2.Mappings.DOTA2EconProfile..ctor()
   at System.RuntimeType.CreateInstanceOfT()
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at AutoMapper.MapperConfigurationExpression.AddProfile[TProfile]()
   at SteamWebAPI2.Utilities.SteamWebInterfaceFactory.<>c.<.ctor>b__4_0(IMapperConfigurationExpression config)
   at AutoMapper.MapperConfiguration.Build(Action`1 configure)
   at AutoMapper.MapperConfiguration..ctor(Action`1 configure)
   at SteamWebAPI2.Utilities.SteamWebInterfaceFactory..ctor(IOptions`1 options)
   at SteamWebAPI2.Utilities.SteamWebInterfaceFactory..ctor(String steamWebApiKey)
   at SteamApiClientTest.Program.Main(String[] args)
   at SteamApiClientTest.Program.<Main>(String[] args)

Apparently, the DOTA2EconProfile AutoMapper profile calls a ConvertUsing method which doesn't seem to exist. The problem doesn't arise with AutoMapper v10.1.1.

babelshift commented 2 years ago

Resolved on #126. Please try the latest 4.4.0 package. Note that automapper 11+ requires a framework compatible with .NET Standard 2.1.