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

KSP DLL load errors #2049

Closed
alex-dev opened this issue Jan 2, 2019 · 2 comments
Closed

KSP DLL load errors #2049

alex-dev opened this issue Jan 2, 2019 · 2 comments

Comments

@alex-dev
Copy link

alex-dev commented Jan 2, 2019

Considering these assemblies may be unloadable by KSP, I am not sure if these errors are to be expected.

[LOG 04:08:15.404] Load(Assembly): Principia/ksp_plugin_adapter
[LOG 04:08:15.404] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\ksp_plugin_adapter.dll
[LOG 04:08:15.405] Load(Assembly): Principia/x64/libglog
[LOG 04:08:15.405] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\libglog.dll
[ERR 04:08:15.408] Failed to load assembly D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\libglog.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
  at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0 

[LOG 04:08:15.408] Load(Assembly): Principia/x64/libprotobuf
[LOG 04:08:15.408] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\libprotobuf.dll
[ERR 04:08:15.411] Failed to load assembly D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\libprotobuf.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
  at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0 

[LOG 04:08:15.411] Load(Assembly): Principia/x64/physics
[LOG 04:08:15.411] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\physics.dll
[ERR 04:08:15.412] Failed to load assembly D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\physics.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
  at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0 

[LOG 04:08:15.412] Load(Assembly): Principia/x64/principia
[LOG 04:08:15.412] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\principia.dll
[ERR 04:08:15.415] Failed to load assembly D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\principia.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
  at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0 

[LOG 04:08:15.415] Load(Assembly): Principia/x64/serialization
[LOG 04:08:15.415] AssemblyLoader: Loading assembly at D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\serialization.dll
[ERR 04:08:15.418] Failed to load assembly D:\Programs\Games\Steam\steamapps\common\Kerbal Space Program\GameData\Principia\x64\serialization.dll:
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
  at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders (System.UInt16& subsystem, System.UInt16& dll_characteristics) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImage () [0x00000] in <filename unknown>:0 
  at Mono.Cecil.PE.ImageReader.ReadImageFrom (System.IO.Stream stream) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.ScanForBadTypeRefs (System.String file) [0x00000] in <filename unknown>:0 
  at AssemblyLoader.LoadExternalAssembly (System.String file) [0x00000] in <filename unknown>:0

If these errors are expected, maybe it would be possible to actually document them.

@eggrobin
Copy link
Member

eggrobin commented Jan 2, 2019

BadImageFormatException is expected.

As outlined in the technical overview, all the work is done in native DLLs (compiled from C++) called from a comparatively lightweight C♯ adapter that handles UI and interactions with the game itself.

These native DLLs are not loaded by KSP directly, and cannot be, but KSP tries to load any DLL it sees, hence the logspam.

This came up once already (#1150), so I guess we can add an entry in the FAQ.

@eggrobin eggrobin closed this as completed Jan 2, 2019
@alex-dev
Copy link
Author

alex-dev commented Jan 2, 2019

That would be perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants