Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VintageStoryServer.exe looks in the wrong place for Core Mods for assembly binding #2378

Open
FalcoGer opened this issue Feb 12, 2023 · 4 comments
Labels
target: modding Affects modding or the API

Comments

@FalcoGer
Copy link

FalcoGer commented Feb 12, 2023

Game Version

v1.17.11

Platform

Windows

Modded

Modded

SP/MP

Multiplayer

Description

I ran into the issue when trying to use the beehivekiln mod on a dedicated windows server machine. I thought at first it was an issue with the mod, but I'm now fairly certain that it's got to do with the server itself.

When running the mod in single player or on a linux server, no issues are present. However when running the mod on a windows dedicated server the mod doesn't work. See logs below.

When looking at the detailed logs you can see that the search path for the DLL is in /C:/Users/server/AppData/Roaming/Vintagestory/

I thought it might have had to do with the modspath setting in the serverconfig. It was

"ModPaths": [
  "Mods",
  "C:\\Users\\server\\AppData\\Roaming\\VintagestoryData\\Mods"
]

I changed it to

"ModPaths": [
  "C:\\Users\\server\\AppData\\Roaming\\Vintagestory\\Mods",
  "C:\\Users\\server\\AppData\\Roaming\\VintagestoryData\\Mods"
]

and that had no effect.

I'm unsure if this is related but creating symlinks (mklink) to the DLLs in the Mods directory in the same directory where the server executable is located stops the errors in the logs, but the mod still doesn't work correctly (although with a slightly different behavior in that the kiln temperature doesn't update properly). It does work in SP and on linux hosted servers though as stated before.

How to reproduce

  1. Install VS
  2. Install beehivekiln mod (v1.2.1)
  3. Run dedicated server
  4. Join the server
  5. Place Flue block
  6. Watch logs

Screenshots

N/A

Logs

The following error is spammed to the log once the flue block has been placed:

11.2.2023 22:00:51 [Fatal] System.IO.FileNotFoundException: Could not load file or assembly 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick3s(Single dt)
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick1s(Single dt) in c:\Users\server\AppData\Roaming\VintagestoryData\Cache\unpack\beehivekiln_v1.2.1.zip_4eaad279077a\src\beehivekiln\blockentity\blockentitybeehivekiln.cs:line 148
   at Vintagestory.Common.EventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Common\EventManager.cs:line 106
   at Vintagestory.Server.CoreServerEventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerEventManager.cs:line 123
   at Vintagestory.Server.ServerMain.Process() in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerMain.cs:line 768

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Enabling the logging by adding the mentioned registry key outputs these errors instead:

12.2.2023 00:59:57 [Event] Falco [::ffff:192.168.1.11]:61724 joins.
12.2.2023 00:59:57 [Notification] A client reconnected, resuming game calendar.
12.2.2023 01:00:16 [Notification] Auto-sync thread running
12.2.2023 01:00:18 [Fatal] System.IO.FileNotFoundException: Could not load file or assembly 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick3s(Single dt)
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick1s(Single dt) in c:\Users\server\AppData\Roaming\VintagestoryData\Cache\unpack\beehivekiln_v1.2.1.zip_4eaad279077a\src\beehivekiln\blockentity\blockentitybeehivekiln.cs:line 148
   at Vintagestory.Common.EventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Common\EventManager.cs:line 106
   at Vintagestory.Server.CoreServerEventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerEventManager.cs:line 123
   at Vintagestory.Server.ServerMain.Process() in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerMain.cs:line 768

=== Pre-bind state information ===
LOG: DisplayName = VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/server/AppData/Roaming/Vintagestory/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/server/AppData/Roaming/Vintagestory/VSSurvivalMod.DLL.
LOG: Attempting download of new URL file:///C:/Users/server/AppData/Roaming/Vintagestory/VSSurvivalMod/VSSurvivalMod.DLL.
LOG: Attempting download of new URL file:///C:/Users/server/AppData/Roaming/Vintagestory/VSSurvivalMod.EXE.
LOG: Attempting download of new URL file:///C:/Users/server/AppData/Roaming/Vintagestory/VSSurvivalMod/VSSurvivalMod.EXE.

12.2.2023 01:00:20 [Fatal] System.IO.FileNotFoundException: Could not load file or assembly 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick3s(Single dt)
   at beehivekiln.blockentity.BlockEntityBeehiveKiln.onServerTick1s(Single dt) in c:\Users\server\AppData\Roaming\VintagestoryData\Cache\unpack\beehivekiln_v1.2.1.zip_4eaad279077a\src\beehivekiln\blockentity\blockentitybeehivekiln.cs:line 148
   at Vintagestory.Common.EventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Common\EventManager.cs:line 106
   at Vintagestory.Server.CoreServerEventManager.TriggerGameTick(Int64 ellapsedMilliseconds, IWorldAccessor world) in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerEventManager.cs:line 123
   at Vintagestory.Server.ServerMain.Process() in C:\Users\Tyron\Documents\vintagestory\game\VintagestoryLib\Server\ServerMain.cs:line 768

=== Pre-bind state information ===
LOG: DisplayName = VSSurvivalMod, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/server/AppData/Roaming/Vintagestory/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

12.2.2023 01:00:24 [Notification] Last player disconnected, compacting large object heap...
12.2.2023 01:00:25 [Event] Player Falco left.
@FalcoGer FalcoGer added the status: new This issue is fresh! label Feb 12, 2023
@Craluminum2413
Copy link
Collaborator

If this happens with only one mod, then the problem is in the mod.
Do other mods like Primitive Survival, Expanded Foods, From Golden Combs etc. load fine?

@Craluminum2413 Craluminum2413 added status: incomplete Could need a little more information and removed status: new This issue is fresh! labels Feb 12, 2023
@FalcoGer
Copy link
Author

FalcoGer commented Feb 12, 2023

Yes they do. But I don't see how that would explain that linux loads fine SP and Dedicated and windows loads fine SP only and dedicated fails.

I also looked over the code and there is no information on where those DLLs are loaded from.

I also found that people have the same issue with uncompiled versions of mods (the ones with the src/ folder) like:

https://mods.vintagestory.at/show/mod/4295#cmt-8164
https://mods.vintagestory.at/thebasics#cmt-3742

Also found this unresolved issue, that might be related:
mono/mono#7393

Primitive survival is precompiled, and so is expanded foods. Maybe it has to do with the live compiling?

@FalcoGer
Copy link
Author

I just compiled the mod myself and replaced the src/ folder with the DLL file. Now the mod works as intended. It must be related to the live compile magic.

@Craluminum2413 Craluminum2413 added target: modding Affects modding or the API and removed status: incomplete Could need a little more information labels Feb 12, 2023
@egocarib
Copy link

I also ran into this previously and ended up having to switch to DLL to resolve it. (See egocarib/Vintage-Story-Mods#1 for more info)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target: modding Affects modding or the API
Projects
None yet
Development

No branches or pull requests

3 participants