G3rste / petai

Library for all my mods introducing tameable cratures to Vintage Story.
MIT License
5 stars 9 forks source link

PetAI crashes and is incompatible with Flathub version of Vintage Story #24

Closed mard closed 2 years ago

mard commented 2 years ago

Why? To be able to play Pet AI-enabled servers on Steam Deck, of course...

Steps to reproduce:

  1. On Linux, install Vintage Story from Flathub (for user only): https://flathub.org/apps/details/at.vintagestory.VintageStory
  2. Run it, log in, close.
  3. Place petai_v1.3.6.zip in ~/.var/app/at.vintagestory.VintageStory/config/VintagestoryData/Mods/ (this location may vary depending on the distribution. This one is specific to Arch Linux / SteamOS 3)
  4. Run it again and start a single player game.
  5. PetAI is not running.

Logs

~/.var/app/at.vintagestory.VintageStory/config/VintagestoryData/Logs/server-main.txt:

7.3.2022 21:44:20 [Error] [petai] Exception thrown when attempting to retrieve all types of the assembly protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67: System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at Vintagestory.Common.ModContainer.GetModSystems (System.Reflection.Assembly assembly) [0x00000] in <6b6988c5e6264e7e8b7a32e875df9528>:0 
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51', InnerException: . Will ignore asssembly. Loader exceptions:
6.3.2022 21:44:20 [Error] [petai] System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
6.3.2022 21:44:20 [Error] [petai] An exception was thrown when trying to load assembly:
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal(System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00013] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00037] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.RuntimeAssembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T] (System.Reflection.Assembly element) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at Vintagestory.Common.ModContainer+<>c__DisplayClass33_0.<LoadAssembly>b__1 (System.Reflection.Assembly ass) [0x00000] in <6b6988c5e6264e7e8b7a32e875df9528>:0 
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <06a1bec0cd6643378846786981f19b07>:0 
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <06a1bec0cd6643378846786981f19b07>:0 
  at Vintagestory.Common.ModContainer.LoadAssembly (Vintagestory.Common.ModCompilationContext compilationContext, Vintagestory.Common.ModAssemblyLoader loader) [0x00169] in <6b6988c5e6264e7e8b7a32e875df9528>:0 

Additionally, Vintage Story will crash trying to join a server that has this mod loaded (such as Aura Fury)

image

~/.var/app/at.vintagestory.VintageStory/config/VintagestoryData/Logs/client-main.txt:

6.3.2022 21:30:04 [Notification] Mods, sorted by dependency: aurafurytweaks, bettercrates, extrachests, specializedbags-10Slot, tradeomat, game, carrycapacity, farmlanddropssoil, medievalexpansion, petai, creative, survival, workbenchexpansion, bricklayers, feverstonehorses
6.3.2022 21:30:04 [Warning] Client side assembly resolver did not find the assembly in the binary path, the lib path or the mods path. Tested for the following paths:
  /app/extra/vintagestory/
  /app/extra/vintagestory/Lib
  /app/extra/vintagestory/Mods
  /home/mard/.var/app/at.vintagestory.VintageStory/config/VintagestoryData/Mods
6.3.2022 21:30:04 [Warning] Client side assembly resolver did not find the assembly in the binary path, the lib path or the mods path. Tested for the following paths:
  /app/extra/vintagestory/
  /app/extra/vintagestory/Lib
  /app/extra/vintagestory/Mods
  /home/mard/.var/app/at.vintagestory.VintageStory/config/VintagestoryData/Mods
6.3.2022 21:30:04 [Error] [petai] Exception thrown when attempting to retrieve all types of the assembly protobuf-net, Version=3.0.0.0, Culture=neutral, PublicKeyToken=257b51d87d2e4d67: System.Reflection.ReflectionTypeLoadException: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
  at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes(System.Reflection.Assembly,bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at Vintagestory.Common.ModContainer.GetModSystems (System.Reflection.Assembly assembly) [0x00000] in <6b6988c5e6264e7e8b7a32e875df9528>:0 
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51', InnerException: . Will ignore asssembly. Loader exceptions:
6.3.2022 21:30:04 [Error] [petai] System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
6.3.2022 21:30:04 [Error] [petai] An exception was thrown when trying to load assembly:
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal(System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00013] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00037] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.RuntimeAssembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T] (System.Reflection.Assembly element) [0x00000] in <50ac1f0036934a2d82336a85babf389a>:0 
  at Vintagestory.Common.ModContainer+<>c__DisplayClass33_0.<LoadAssembly>b__1 (System.Reflection.Assembly ass) [0x00000] in <6b6988c5e6264e7e8b7a32e875df9528>:0 
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x0001b] in <06a1bec0cd6643378846786981f19b07>:0 
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <06a1bec0cd6643378846786981f19b07>:0 
  at Vintagestory.Common.ModContainer.LoadAssembly (Vintagestory.Common.ModCompilationContext compilationContext, Vintagestory.Common.ModAssemblyLoader loader) [0x00169] in <6b6988c5e6264e7e8b7a32e875df9528>:0 

Possible clue

Make PetAI independent of netstandard. PetAI is targeting net461 and one of PetAI dependencsies, protobuf-net also has builds for net461. That's what Pet AI should be using. However, I suspect that your build seems to pull the netstandard version of protobuf-net, not the net461 version.

Screenshot_20220306_225259

G3rste commented 2 years ago

Does fix your problems? PetAI should now use the Libs that are explicitly shipped with VS. petai.zip

mard commented 2 years ago

Does fix your problems? petai.zip

Yes, looks good. No errors serverside and client loads it as well.

G3rste commented 2 years ago

Nice. I will merge this and include the changes in the next feature update.