abnerfs / cs2-rockthevote

General purpose cs2 map voting plugin, made with love from scratch
87 stars 28 forks source link

[BUG]: Failed to load plugin: Global Variables not initialized yet in CSSharp v238 #71

Open kus opened 3 months ago

kus commented 3 months ago

A new update for CounterStrikeSharp came out today which has the text fix: improve error handling if globals are accessed before ready.

When using CounterStrikeSharp v238 you now get the following error, it works by downgrading back to v237.

I get the error on both Windows and Ubuntu.

09:21:32 [INFO] (cssharp:PluginContext) Loading plugin RockTheVote
09:21:32 [EROR] (cssharp:PluginManager) Failed to load plugin from /home/steam/cs2/game/csgo/addons/counterstrikesharp/plugins/RockTheVote/RockTheVote.dll
CounterStrikeSharp.API.Core.NativeException: Global Variables not initialized yet.
   at CounterStrikeSharp.API.Core.ScriptContext.CheckErrors() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/ScriptContext.cs:line 176
   at CounterStrikeSharp.API.Core.NativeAPI.GetMapName() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/API.cs:line 262
   at cs2_rockthevote.Core.MapCooldown.<.ctor>b__5_0(Object e, Map[] maps) in /Users/kus/dev/personal/counter-strike/cssharp/cs2-rockthevote/Core/MapCooldown.cs:line 17
   at cs2_rockthevote.MapLister.LoadMaps() in /Users/kus/dev/personal/counter-strike/cssharp/cs2-rockthevote/CrossCutting/MapLister.cs:line 45
   at cs2_rockthevote.DependencyManager`2.OnPluginLoad(TPlugin plugin) in /Users/kus/dev/personal/counter-strike/cssharp/cs2-rockthevote/CrossCutting/DependencyManager.cs:line 52
   at cs2_rockthevote.Plugin.Load(Boolean hotReload) in /Users/kus/dev/personal/counter-strike/cssharp/cs2-rockthevote/Plugin.cs:line 62
   at CounterStrikeSharp.API.Core.Plugin.PluginContext.Load(Boolean hotReload) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/PluginContext.cs:line 218
   at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.LoadPlugin(String path) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 125
   at CounterStrikeSharp.API.Core.Plugin.Host.PluginManager.Load() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Plugin/Host/PluginManager.cs:line 93
audiomaster99 commented 3 months ago

CSS issue, downgrade to v237

kus commented 3 months ago

@audiomaster99 yeah, but the issue is the plugin is accessing the global variables before they are initialised so that should be fixed.