d2 icon indicating copy to clipboard operation
d2 copied to clipboard

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

Open fusion809 opened this issue 5 years ago • 20 comments

Hi,

When launching the AppImage for commit 2b37e3571355a930b781979ea5b9c18b6297fbaf 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.

fusion809 avatar Jul 03 '19 04:07 fusion809

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

evgeniysergeev avatar Sep 28 '19 06:09 evgeniysergeev

Yep, I'm afraid so.

fusion809 avatar Sep 28 '19 06:09 fusion809

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.

GraionDilach avatar Sep 28 '19 08:09 GraionDilach

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).

fusion809 avatar Sep 28 '19 09:09 fusion809

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

https://github.com/OpenRA/d2/blob/0a74333011044263084f9e714035200fbb676fd7/OpenRA.Mods.D2/Widgets/D2SpriteWidget.cs#L14

@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, https://github.com/OpenRA/OpenRA/pull/15973 gives you the examples to look at.

GraionDilach avatar Sep 28 '19 10:09 GraionDilach

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

https://github.com/OpenRA/d2/blob/0a74333011044263084f9e714035200fbb676fd7/OpenRA.Mods.D2/Widgets/D2SpriteWidget.cs#L14

@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 https://github.com/OpenRA/OpenRAModSDK/issues/123

evgeniysergeev avatar Sep 28 '19 12:09 evgeniysergeev

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

GraionDilach avatar Sep 28 '19 13:09 GraionDilach

#154 merged

evgeniysergeev avatar Sep 28 '19 18:09 evgeniysergeev

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

fusion809 avatar Sep 28 '19 20:09 fusion809

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

GraionDilach avatar Sep 28 '19 21:09 GraionDilach

https://github.com/OpenRA/d2/blob/f2134671157bb32106a651d0a3543132bec2496b/mod.config#L137

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

This will be updated in #156

evgeniysergeev avatar Sep 29 '19 04:09 evgeniysergeev

https://github.com/OpenRA/d2/blob/f2134671157bb32106a651d0a3543132bec2496b/mod.config#L137

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

This will be updated in #156

#156 merged

evgeniysergeev avatar Oct 01 '19 04:10 evgeniysergeev

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

fusion809 avatar Oct 01 '19 06:10 fusion809

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!

pchote avatar Oct 04 '19 09:10 pchote

Waiting for #160 #161 #162

evgeniysergeev avatar Oct 04 '19 22:10 evgeniysergeev

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

evgeniysergeev avatar Oct 05 '19 06:10 evgeniysergeev

Sure, happy to give it a go.

fusion809 avatar Oct 05 '19 07:10 fusion809

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

evgeniysergeev avatar Oct 05 '19 16:10 evgeniysergeev

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

fusion809 avatar Oct 05 '19 16:10 fusion809

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

fusion809 avatar Oct 05 '19 16:10 fusion809