babelshift/SteamWebAPI2

Bug when trying to use CreateSteamWebInterface

sp0ok3r opened this issue ยท 13 comments

Same problem here..

Thanks. I'll take a look today.

Thanks. I'll take a look today.

Thank you for your prompt reply

Thanks. I'll take a look today.

How is it going? Any updates?

Hey guys. Sorry, this repo is a side project for me when I get time outside my full time job (which can be very demanding). I'm trying to get some time soon. Thanks for understanding.

@sp0ok3r @EAbychkov what version are you using? The latest (4.0.14)? What .NET runtime are you using? Full framework or .NET Core?

I'm having trouble reproducing this issue on .NET Core 2.1 console app with 4.0.14 nuget package. The following is working as expected in my setup.

var webInterfaceFactory = new SteamWebInterfaceFactory("<api_key>");
var steamInterface = webInterfaceFactory.CreateSteamWebInterface<PlayerService>(new HttpClient());
var playerSummaryResponse = await steamInterface.GetOwnedGamesAsync(<steam_id>);

@sp0ok3r @EAbychkov what version are you using? The latest (4.0.14)? What .NET runtime are you using? Full framework or .NET Core?

Yes, the latest version
I'm using .NET Core 3.0

We are trying to use a code example from the main page, there is SteamUser, not PlayerService:
var steamInterface = webInterfaceFactory.CreateSteamWebInterface<SteamUser>(new HttpClient());

@EAbychkov the original screenshot in this issue from @sp0ok3r is using PlayerService.

Regardless, even when using SteamUser and migrating my console app .NET Core 3.1, I still cannot reproduce. Below is the full contents of the test class.

using System.Net.Http;
using System.Threading.Tasks;
using SteamWebAPI2.Interfaces;
using SteamWebAPI2.Utilities;

namespace TestSteamWebAPI2.Core
{
    class Program
    {
        async static Task Main(string[] args)
        {
            var webInterfaceFactory = new SteamWebInterfaceFactory("<api_key>");
            var steamInterface = webInterfaceFactory.CreateSteamWebInterface<SteamUser>(new HttpClient());
            var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(76561197960361544);
            var playerSummaryData = playerSummaryResponse.Data;
        }
    }
}

Your screenshot shows a MethodNotFoundException in AutoMapper. What version of AutoMapper does your project use? SteamWebAPI2 relies on 6.1.1. Later versions are not guaranteed to work.

See: aspnetboilerplate/aspnetboilerplate#4025 for an issue in AutoMapper 8 that looks identical to yours.

@babelshift Do you have plans to move it to the AutoMapper 9?
Because it makes it impossible to use.
I have just moved your code to AutoMapper 9, it took about 20 min. But I want to use the NuGet package.

Feel free to create a pull request with your changes.

Updated AutoMapper #84 and Newtsonsoft.Json #85 and released on version 4.0.15.