MaxWasUnavailable / LobbyCompatibility

Towards a future with fewer lobby incompatibility errors.
GNU Lesser General Public License v3.0
5 stars 3 forks source link

NullReferenceException and breaks list. #66

Closed xAstroBoy closed 6 months ago

xAstroBoy commented 6 months ago

[20:34:41.9251125] [Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object Stack trace: LobbyCompatibility.Features.PluginHelper.HasCompatibilityAttribute (BepInEx.BaseUnityPlugin plugin) (at ./Features/PluginHelper.cs:59) LobbyCompatibility.Features.PluginHelper+<>c.b7_0 (System.Collections.Generic.KeyValuePair2[TKey,TValue] plugin) (at ./Features/PluginHelper.cs:68) System.Linq.Enumerable+WhereSelectEnumerableIterator2[TSource,TResult].ToList () (at :IL_001B) System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at :IL_001F) LobbyCompatibility.Features.PluginHelper.GetAllPluginInfo () (at ./Features/PluginHelper.cs:91) LobbyCompatibility.Features.PluginHelper.GetRequiredPluginsChecksum () (at ./Features/PluginHelper.cs:262) LobbyCompatibility.Features.PluginHelper.get_Checksum () (at ./Features/PluginHelper.cs:36) LobbyCompatibility.Patches.LoadServerListTranspiler.LoadListPostfix (SteamLobbyManager steamLobbyManager) (at ./Patches/LoadServerListTranspiler.cs:86) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b7_0 (System.Object state) (at <787acc3c9a4c471ba7d971300105af24>:IL_0000) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at :IL_0002) UnityEngine.UnitySynchronizationContext.Exec () (at :IL_005D) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at :IL_0014)

MaxWasUnavailable commented 6 months ago

Could you give us some more information on what other plugins you're using, and when this error occured?

xAstroBoy commented 6 months ago

Could you give us some more information on what other plugins you're using, and when this error occured?

i did just this small hotfix with dnspy

PluginHelper.HasCompatibilityPlugin seems to be causing the issue

i just added a couple nullchecks.

MaxWasUnavailable commented 6 months ago

What other mods were present, though? It's important for us to know why this happens since it might point at an issue elsewhere.

Could you provide us your game logs?

xAstroBoy commented 6 months ago

018e871b-4e3b-4094-11dd-5d8e25a96b83

Is mostly Client side mods.

MaxWasUnavailable commented 6 months ago

Could you please forward us your game logs for a playthrough when this error happens?

xAstroBoy commented 6 months ago

Could you please forward us your game logs for a playthrough when this error happens?

there's no error, just that exception, i fixed it myself locally by adding null checks...

MaxWasUnavailable commented 6 months ago

The rest of the game logs would still be good as additional context for us to look into what's triggering this, so we can ensure null checks aren't just a bandaid fix while the real problem is somewhere else / in the way we're checking things / etc...

xAstroBoy commented 6 months ago

The rest of the game logs would still be good as additional context for us to look into what's triggering this, so we can ensure null checks aren't just a bandaid fix while the real problem is somewhere else / in the way we're checking things / etc...

null checks are not a bandaid, install the modpack with r2modman and see it by yourself, not all mods have that attribute

Xilophor commented 6 months ago

@MaxWasUnavailable Is it possible that a plugin hasn't loaded yet, and running GetType is causing the NRE?

MaxWasUnavailable commented 6 months ago

Possibly? I don't recall us running into this during any of our testing with plugins that both have and don't have the attribute, though. Hence why I'd love a log so we can check if there's anything weird going on.

I'd rather not slap try/catch or null checks everywhere in case it is an issue that should error, or in case it's a situation where we're doing things out of order (as you suggest), and where a null check would just hide the error but not fix the problem.

Xilophor commented 6 months ago

Looking at that stack-trace, it appears to be happening when loading the server list, when all mods should be loaded. For some reason some of the plugins/mods appear to not be loaded, which doesn't make sense to me.