BenFradet / RiotSharp

C# wrapper for the Riot Games API
http://benfradet.github.io/RiotSharp/
MIT License
301 stars 145 forks source link

[Question] Assembly exception #458

Closed dgraney closed 6 years ago

dgraney commented 7 years ago

Hello, after building the latest version (from Github) and adding it to my current project (a Discord.NET bot), I am receiving the following exception: System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. and inner exception: FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

This has occurred twice now, even when referencing System.Runtime, this still bugs out. I do not necessarily believe that it is the library at fault, but hopefully someone here understands the dependencies from the library better than I do. It is being thrown upon building the application.

Thank you ahead of time

bartdebever commented 7 years ago

Having a similar issue with System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

dgraney commented 7 years ago

Not at my computer to test, but the issue may be framework-to-standard compatibility. If I remember correctly, RiotSharp targets .NET standard 1.3, my application targeted 4.5.2.

Here is a matrix of supported frameworks for a given .NET standard: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

And here is mention to a nuget package that is potentially required: https://github.com/dotnet/standard/issues/328

Sent from my Lge LG-K373 using FastHub

dgraney commented 7 years ago

Returned to my computer, so here is an update: Building the application with the new target .NET framework of 4.6.1 pushed the application beyond where it previously was. However, now I am receiving a new error: the same one described in @bartdebever comment. Exception: {"Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}

Stack Trace (paths hidden for privacy): " at RiotSharp.Http.RequesterBase..ctor(String apiKey)\r\n at RiotSharp.Http.RateLimitedRequester..ctor(String apiKey, IDictionary2 rateLimits)\r\n at RiotSharp.RiotApi..ctor(String apiKey, IDictionary2 rateLimits)\r\n at RiotSharp.RiotApi.GetInstance(String apiKey, IDictionary2 rateLimits)\r\n at RiotSharp.RiotApi.GetDevelopmentInstance(String apiKey, Int32 rateLimitPer1s, Int32 rateLimitPer2m)\r\n at HearthstoneBot.League.SetRiotApi() in C:\\Users\\<ProjectPath>\\League.cs:line 197\r\n at HearthstoneBot.Program.<Start>d__2.MoveNext() in C:\\Users\\<ProjectPath>\\Program.cs:line 37"

BenFradet commented 7 years ago

Pinging @JanOuborny since he was the last one working on the build

dgraney commented 7 years ago

Quick update: New error was simply from my System.Net.Http.dll not being up to date. A simple NuGet package fixed that, along with Newtonsoft.Json needing to be updated. That was on me, sorry.

It's moving along thankfully. Finally, I am receiving a 403 error :( Hopefully this is a more common and simple fix. Checked and rechecked my api key, it was just updated. I am using RiotApi.GetDevelopmentInstance("InsertKeyHere") and the 403 is occurring via RiotApi.GetSummonerByName(Region,Name)

dgraney commented 7 years ago

Correction to the above: The 403 is triggering on requesting the most recent game. My code is as follows: var summoner = riotApi.GetSummonerByName(RiotSharp.Misc.Region.na, summonerName);
Game mostRecentGame = summoner.GetRecentGames().FirstOrDefault();

After taking a look at the Riot API along with the endpoints used in the code, it looks like this call will have to wait for v3.0

BenFradet commented 7 years ago

The Game API hasn't been ported to V3 unfortunately, I created #460

dgraney commented 7 years ago

Thanks Ben!

N0ct3 commented 6 years ago

@dgraney got the same "filenotfound" issue than you with 'System.Net.Http' Version=4.1.1.0, except that updating the nuget packages did not seem to fix it... any tip?

dgraney commented 6 years ago

@N0ct3 Not entirely sure to be honest. Updating the System.Net.Http nuget package worked for me if I remember correctly :(

BenFradet commented 6 years ago

Just published 3.0.0, feel free to open new issues if you run into problems 👍