OpenRA/d2

Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown

fusion809 opened this issue · 20 comments

Hi,

When launching the AppImage for commit 2b37e35 I get the exception:

Exception of type `System.Reflection.ReflectionTypeLoadException`: Exception of type 'System.Reflection.ReflectionTypeLoadException' was thrown.
Could not resolve type with token 010000a8 from typeref (expected class 'OpenRA.Traits.ResourceTypeInfo' in assembly 'OpenRA.Game, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null')
Could not resolve type with token 010000a8 from typeref (expected class 'OpenRA.Traits.ResourceTypeInfo' in assembly 'OpenRA.Game, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null')
Could not resolve type with token 010001dd from typeref (expected class 'OpenRA.Activities.CompositeActivity' in assembly 'OpenRA.Game, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null')
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Could not load file or assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

Here's a zip archive for all the relevant logs (only the exception log exists, all others are empty): logs-20190703-d2.zip.

Hello, @fusion809,
Is this reproduced on latest code?

Yep, I'm afraid so.

AppImages built upon the last release requires a proper Mono framework upon the system.

#146 has been merged though so I really try for a reproduction, since that bumped everything to playtest.

Seems unlikely to be the cause, as I can run Dune II without a problem using ./launch-game.sh, after manually compiling it. I can also run it from my AUR package of it. Likewise, I can run Red Alert, Dune 2K and Tiberian Dawn AppImages built on this system from the latest commits of the upstream OpenRA repo (https://github.com/OpenRA/OpenRA).

Yes, you're correct with that not being the cause - just found it here:

using System.Drawing;

@evgeniysergeev Upstream removed System.Drawing usage because that lead to a lot of dependencies required to be integrated into the AppImage and the crash is caused by this. You need to follow suit, OpenRA/OpenRA#15973 gives you the examples to look at.

Yes, you're correct with that not being the cause - just found it here:

using System.Drawing;

@evgeniysergeev Upstream removed System.Drawing usage because that lead to a lot of dependencies required to be integrated into the AppImage and the crash is caused by this. You need to follow suit, OpenRA/OpenRA#15973 gives you the examples to look at.

Should be fixed in #154
But this is changes only in d2 mod, not in modSdk. for modSDK waiting for OpenRA/OpenRAModSDK#123

The ModSDK issue is limited to the Windows path however and should not involve a running AppImage. So #154 should fix the crash here.

Ah, folks I hate to be a buzzkill but the AppImage issue seems to have survived. I am still getting that error.

d2/mod.config

Line 137 in f213467

WHITELISTED_CORE_ASSEMBLIES="mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll OpenRA.Mods.Cnc.dll System.Drawing.dll"
was not updated compared to
https://github.com/OpenRA/OpenRAModSDK/blob/5e1de7189d140049f91b3f88f3771b4c97f0b47a/mod.config#L137

d2/mod.config

Line 137 in f213467

WHITELISTED_CORE_ASSEMBLIES="mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll OpenRA.Mods.Cnc.dll System.Drawing.dll"

was not updated compared to
https://github.com/OpenRA/OpenRAModSDK/blob/5e1de7189d140049f91b3f88f3771b4c97f0b47a/mod.config#L137

This will be updated in #156

d2/mod.config

Line 137 in f213467

WHITELISTED_CORE_ASSEMBLIES="mscorlib.dll System.dll System.Configuration.dll System.Core.dll System.Numerics.dll System.Security.dll System.Xml.dll Mono.Security.dll OpenRA.Mods.Cnc.dll System.Drawing.dll"

was not updated compared to
https://github.com/OpenRA/OpenRAModSDK/blob/5e1de7189d140049f91b3f88f3771b4c97f0b47a/mod.config#L137

This will be updated in #156

#156 merged

Sorry folks, but the error still seems to exist with the latest commit.

There seems to be several layers of problems here...

The errors reported by make check will need to be fixed before the AppImage has any chance of reliably working (hint: you are using the Mods.Cnc dll but don't tell the SDK to package it). You should also go back through the instructions in https://github.com/OpenRA/OpenRAModSDK/releases/tag/20190825 and redo the mod.config changes. Your dll whitelist definitions, in particular, are not set up correctly.

We put a lot of effort into building the make check and make test commands to automatically identify errors like this. You would save a lot of trouble by running these a regular part of your workflow and taking the time to understand what causes them.

Both the AppImage and launch-game scripts crash on startup for me because the load screen can't find IBM.PAL. The load screen and content installer must not reference any external files because users will not otherwise be able to install them!

Waiting for #160 #161 #162

Can we try to package and run again, after #163 will be merged

Sure, happy to give it a go.

Sure, happy to give it a go.

You can test using https://github.com/evgeniysergeev/d2/tree/fix-tests branch this way you don’t need to wait for merge and we will know is that changes helps or not

Odd, I get this error when building the AppImage:

Installing OpenRA engine to /data/GitHub/others/d2-fork/packaging/linux/D2Mod.appdir/usr/lib/openra
Installing OpenRA common mod files to /data/GitHub/others/d2-fork/packaging/linux/D2Mod.appdir/usr/lib/openra
cp: cannot stat './mods/cnc/OpenRA.Mods.Cnc.dll': No such file or directory

If it helps running:

find . -name "OpenRA.Mods.Cnc.dll"

in the top level of this repo, returns:

./engine/mods/common/OpenRA.Mods.Cnc.dll
./engine/OpenRA.Mods.Cnc/obj/Release/OpenRA.Mods.Cnc.dll
./packaging/linux/D2Mod.appdir/usr/lib/openra/mods/common/OpenRA.Mods.Cnc.dll