maxisoft / ASFFreeGames

Collect free steam games while asf is running
GNU Affero General Public License v3.0
122 stars 2 forks source link

System.TypeLoadException: Could not load type 'System.WeakReference`1' from assembly #13

Closed JourneyOver closed 1 year ago

JourneyOver commented 1 year ago

Describe the bug

ASF has updated to using .NET 7 in their releases (starting as of pre-release 5.4.0.1) and now throws errors upon starting up with ASFFreeGames and eventually causes ASF to shut down with a nonzero error code.

2022-11-17 21:37:10|ArchiSteamFarm-18|INFO|ASF|InitCore() ArchiSteamFarm V5.4.0.1 (linux-x64/03862941-877c-441b-9ab6-a1024b74cf02 | .NET 7.0.0; debian.11-x64; Linux 5.15.0-52-generic #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022)
2022-11-17 21:37:11|ArchiSteamFarm-18|INFO|ASF|InitCore() Copyright © 2015-2022 JustArchiNET
2022-11-17 21:37:11|ArchiSteamFarm-18|WARN|ASF|InitGlobalConfigAndLanguage() config/ASF.json config file will be migrated to the latest syntax...
2022-11-17 21:37:11|ArchiSteamFarm-18|INFO|ASF|InitGlobalConfigAndLanguage() Done!
2022-11-17 21:37:11|ArchiSteamFarm-18|INFO|ASF|InitPlugins() Initializing Plugins...
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() Loading ASFEnhance V1.6.18.1...
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|OnLoaded() 
==========================================
 █████╗ ███████╗███████╗███████╗███╗   ██╗██╗  ██╗ █████╗ ███╗   ██╗ ██████╗███████╗
██╔══██╗██╔════╝██╔════╝██╔════╝████╗  ██║██║  ██║██╔══██╗████╗  ██║██╔════╝██╔════╝
███████║███████╗█████╗  █████╗  ██╔██╗ ██║███████║███████║██╔██╗ ██║██║     █████╗  
██╔══██║╚════██║██╔══╝  ██╔══╝  ██║╚██╗██║██╔══██║██╔══██║██║╚██╗██║██║     ██╔══╝  
██║  ██║███████║██║     ███████╗██║ ╚████║██║  ██║██║  ██║██║ ╚████║╚██████╗███████╗
╚═╝  ╚═╝╚══════╝╚═╝     ╚══════╝╚═╝  ╚═══╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝╚══════╝
ASFEnhance Version 1.6.18.1
Developed by Chr_, email chr@chrxw.com
https://afdian.net/@chr233
==========================================
Use Command "ASFEVERSION" / "AV" to check the plugin's latest version
Use Command "ASFEUPDATE" / "AU" to update the plugin
==========================================

2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() ASFEnhance has been loaded successfully!
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() Loading ASFFreeGamesPlugin V1.2.8.0...
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() ASFFreeGamesPlugin has been loaded successfully!
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() Loading SteamTokenDumperPlugin V5.4.0.1...
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() SteamTokenDumperPlugin has been loaded successfully!
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|InitPlugins() You've loaded one or multiple custom plugins into ASF. Since we're unable to offer support for modded setups, please contact the appropriate developers of the plugins that you decided to use in case of any issues.
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|UpdateAndRestart() ASF will automatically check for new versions every 1 day.
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|Update() Checking for new version...
2022-11-17 21:37:12|ArchiSteamFarm-18|INFO|ASF|Update() Local version: 5.4.0.1 | Remote version: 5.4.0.1
2022-11-17 21:37:22|ArchiSteamFarm-18|INFO|ASF|Load() Loading STD global cache...
2022-11-17 21:37:23|ArchiSteamFarm-18|INFO|ASF|Load() Validating STD global cache integrity...
2022-11-17 21:37:23|ArchiSteamFarm-18|INFO|ASF|OnASFInit() SteamTokenDumperPlugin has been initialized successfully, thank you in advance for your help. The first submission will happen in approximately 24 minutes from now.
2022-11-17 21:37:23|ArchiSteamFarm-18|INFO|ASF|Start() Starting IPC server...
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|Microsoft.Hosting.Lifetime|Now listening on: http://[::]:1242
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|Microsoft.Hosting.Lifetime|Application started. Press Ctrl+C to shut down.
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|Microsoft.Hosting.Lifetime|Hosting environment: Production
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|Microsoft.Hosting.Lifetime|Content root path: /app
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|ASF|Start() IPC server ready!
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|JourneyOver|Start() Starting...
2022-11-17 21:37:24|ArchiSteamFarm-18|INFO|JourneyOver|Connect() Connecting...
2022-11-17 21:37:25|ArchiSteamFarm-18|INFO|JourneyOver|OnConnected() Connected to Steam!
2022-11-17 21:37:25|ArchiSteamFarm-18|INFO|JourneyOver|OnConnected() Logging in...
2022-11-17 21:37:26|ArchiSteamFarm-18|INFO|JourneyOver|OnLoggedOn() Successfully logged on as 76561198037630370/Journey_Over.
2022-11-17 21:37:26|ArchiSteamFarm-18|INFO|JourneyOver|Init() Logging in to ISteamUserAuth...
2022-11-17 21:37:26|ArchiSteamFarm-18|INFO|JourneyOver|Init() Success!
2022-11-17 21:37:26|ArchiSteamFarm-18|ERROR|ASF|OnBotLoggedOn() System.TypeLoadException: Could not load type 'System.WeakReference`1' from assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken={idkifthisshouldberemovedornot}'.
   at Maxisoft.ASF.BotContext..ctor(Bot bot)
   at Maxisoft.ASF.ASFFreeGamesPlugin.RegisterBot(Bot bot)
   at Maxisoft.ASF.ASFFreeGamesPlugin.OnBotLoggedOn(Bot bot)
   at ArchiSteamFarm.Core.Utilities.InParallel(IEnumerable`1 tasks)
   at ArchiSteamFarm.Plugins.PluginsCore.OnBotLoggedOn(Bot bot)
2022-11-17 21:37:27|ArchiSteamFarm-18|DEBUG|JourneyOver|Refresh() There are no apps that require a refresh on this bot instance.
2022-11-17 21:37:28|ArchiSteamFarm-18|INFO|JourneyOver|IsAnythingToFarm() Checking first badge page...
2022-11-17 21:37:29|ArchiSteamFarm-18|INFO|JourneyOver|IsAnythingToFarm() Checking other badge pages...
2022-11-17 21:37:30|ArchiSteamFarm-18|INFO|JourneyOver|StartFarming() We don't have anything to farm on this account!
2022-11-17 21:37:57|ArchiSteamFarm-18|INFO|ASF|CollectGames() [FreeGames] found potentially 25 free games on reddit
2022-11-17 21:37:57|ArchiSteamFarm-18|FATAL|ASF|OnUnhandledException() System.Collections.Generic.KeyNotFoundException: The given key 'JourneyOver' was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey)
   at Maxisoft.ASF.ASFFreeGamesPlugin.CollectGames(IEnumerable`1 bots, CollectGameRequestSource requestSource, CancellationToken cancellationToken)
   at Maxisoft.ASF.ASFFreeGamesPlugin.CollectGamesOnClock(Object source)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
2022-11-17 21:37:57|ArchiSteamFarm-18|ERROR|ASF|Exit() Exiting with nonzero error code!
2022-11-17 21:37:57|ArchiSteamFarm-18|INFO|Microsoft.Hosting.Lifetime|Application is shutting down...

To Reproduce Steps to reproduce the behavior:

  1. Download the latest release (as of now it is v1.2.8.0) and place in the plugins folder
  2. Start up ASF pre-release
  3. See first error after short moment
  4. Let it try to collect a game
  5. See Second error and it shut itself down

Expected behavior

Well for it to not throw errors and shut down.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

Downgrading back to the stable release and things work just fine obviously because the stable version hasn't been updated to use .net 7 yet, but I'm sure it won't be too long till it does.

maxisoft commented 1 year ago

Thank for reporting.
Issue is fixed with V1.2.9 (tested on docker images + net7 + ArchiSteamFarm 5.4.0.1).

JourneyOver commented 1 year ago

Can confirm that it is indeed working with v1.2.9 :D

azhuge233 commented 1 year ago

Hi, same error happens again in ArchiSteamFarm V5.4.0.3, using v1.2.9.

2022-12-05 20:02:48|ArchiSteamFarm-3490465|ERROR|ASF|OnBotLoggedOn() System.TypeLoadException: Could not load type 'System.WeakReference`1' from assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXX'.
   at Maxisoft.ASF.BotContext..ctor(Bot bot)
   at Maxisoft.ASF.ASFFreeGamesPlugin.RegisterBot(Bot bot)
   at Maxisoft.ASF.ASFFreeGamesPlugin.OnBotLoggedOn(Bot bot)
   at ArchiSteamFarm.Core.Utilities.InParallel(IEnumerable`1 tasks)
   at ArchiSteamFarm.Plugins.PluginsCore.OnBotLoggedOn(Bot bot)

...

2022-12-05 20:02:58|ArchiSteamFarm-3490465|INFO|ASF|CollectGames() [FreeGames] found potentially 22 free games on reddit
2022-12-05 20:02:58|ArchiSteamFarm-3490465|FATAL|ASF|OnUnhandledException() System.Collections.Generic.KeyNotFoundException: The given key '[Bot's name here]' was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey)
   at Maxisoft.ASF.ASFFreeGamesPlugin.CollectGames(IEnumerable`1 bots, CollectGameRequestSource requestSource, CancellationToken cancellationToken)
   at Maxisoft.ASF.ASFFreeGamesPlugin.CollectGamesOnClock(Object source)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
2022-12-05 20:02:58|ArchiSteamFarm-3490465|ERROR|ASF|Exit() 正在以非 0 错误代码退出!
2022-12-05 20:02:58|ArchiSteamFarm-3490465|INFO|Microsoft.Hosting.Lifetime|Application is shutting down...
JourneyOver commented 1 year ago

Running 5.4.0.3 and using 1.2.9 and can not confirm that this is still an issue as I'm not getting the error, so could be something with your system @azhuge233 ... I would suggest posting the full log btw as it may help in determining your issue.