galaxy-integration-humblebundle icon indicating copy to clipboard operation
galaxy-integration-humblebundle copied to clipboard

Plugin crashed due to blocked dll (System.IO.FileLoadException)

Open Fiurgeist opened this issue 3 years ago • 10 comments

Describe the bug I'm unable to connect using any newer version of this plugin, just getting the message 'Plugin has crashed. Retry.'.

Expected behavior Plugin does not crash. Version 0.6.0 of this plugin is the last version were the connect works, showing me the Humble Bundle login mask (but that version is of course useless since the API changed).

Plugin installed I tried both ways, installed it directly from Galaxy as well as manually testing every release from 0.7.0 till 0.9.4.

Provide logs

  • there are no plugin-humble-f0ca3d80-a432-4d35-a9e3-60f27161ac3a.log files written
  • I checked all log files and the only logs written while the plugin crashes are in GalaxyClient.log:
2021-03-13 15:53:05.438 [Information][ (0)] [TID 17004][galaxy_client]: Starting import of friends for platform 'steam'.
2021-03-13 15:53:05.540 [Information][ (0)] [TID 17004][galaxy_client]: Successfully imported XXX friends from platform 'steam'
2021-03-13 15:53:05.658 [Notice][ (0)] [TID 11508][galaxy_client]: Request to set external friends will not be sent as friends info didn't change for platform steam.
2021-03-13 15:53:05.759 [Information][ (0)] [TID 17004][galaxy_client]: Successfully imported presence information for user XXX
2021-03-13 15:53:05.759 [Information][ (0)] [TID 17004][galaxy_client]: Presence (state: offline, game id: unknown_<<NULL>>, game title: <<NULL>>, in_game_status: <<NULL>>, full_status: <<NULL>>) imported for user XXX.
2021-03-13 15:53:05.759 [Information][ (0)] [TID 17004][galaxy_client]: All user presence informations received from plugin.
2021-03-13 15:53:05.759 [Information][ (0)] [TID 17004][galaxy_client]: Importing presence for platform 'steam' finished
2021-03-13 15:53:08.810 [Information][ (0)] [TID 17004][galaxy_client]: Trying to start plugin - pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a.
2021-03-13 15:53:08.829 [Information][ (0)] [TID 17004][galaxy_client]: Plugin pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a process started, waiting for 30 s for connection + 10 for capabilities + 10 for persistent storage
2021-03-13 15:53:08.829 [Information][ (0)] [TID 17004][galaxy_client]: Plugin pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a starting...
2021-03-13 15:53:08.830 [Information][ (0)] [TID 17004][galaxy_client]: Prepared presence update with 1 potentially changed and 0 removed for steam platform(s).
2021-03-13 15:53:09.049 [Notice][ (0)] [TID 11508][galaxy_client]: Request to set external users will not be sent as users info didn't change for platform steam.
2021-03-13 15:53:10.866 [Information][ (0)] [TID 17004][galaxy_client]: Plugin pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a stopped, previous state 4
2021-03-13 15:53:10.866 [Error][ (0)] [TID 17004][galaxy_client]: Plugin - pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a has crashed.
2021-03-13 15:53:10.871 [Information][ (0)] [TID 17004][galaxy_client]: Sending problem report of type Plug-In-Crashed-Error: {"Arguments":{"applicationType":"GOG Galaxy","clientVersion":"2.0.35.19","detectedOsVersion":"win10","isRunningOnWine":false,"os":"windows","osIdentification":"windows: Windows 10 10.0 (Build 18363)","pluginId":"pluginID/humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a","updateChannel":"master"},"ProblemReport":"Plug-In-Crashed-Error"}

Fiurgeist avatar Mar 13 '21 16:03 Fiurgeist

fyi: I put some logging at the first line of the main-method in plugin.py, it doesn't even reach that point.

Fiurgeist avatar Mar 15 '21 19:03 Fiurgeist

Strange. My guess is that some dependencies causes crash on load time.

What OS do you use, which version?

UncleGoogle avatar Mar 16 '21 22:03 UncleGoogle

  • Open cmd (assuming you're on windows)
  • go to plugin location by running cd %LocalAppData%\GOG.com\Galaxy\plugins\installed\humble-...
  • run "C:\Program Files (x86)\GOG Galaxy\python\python.exe" -c "import sys; sys.path.append('.'); import plugin; plugin.main()""

paste here what you see

UncleGoogle avatar Mar 16 '21 22:03 UncleGoogle

yea Win10 (last line of the log was the crash report)

--

I got:

...\humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a>"D:\Program Files (x86)\GOG Galaxy\python\python.exe"
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
>>> import sys
>>> sys.path.append('.')
>>> import plugin

System.IO.FileLoadException:  Could not load file or assembly "file:///<...>\humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a\modules\Python.Runtime.dll" or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

As a quick-fix I've added an python.exe.config in D:\Program Files (x86)\GOG Galaxy\python with

<configuration>
   <runtime>
      <loadFromRemoteSources enabled="true"/>
   </runtime>
</configuration>

and the plugin works again.

--

The question would now be: Why is the humblebundle plugin the only plugin which needs to load a python dll?

Fiurgeist avatar Mar 19 '21 20:03 Fiurgeist

Oh, so you have your user directory in shared network drive? Not strange that OS is scared to execute remote code.

Python.Runtime.dll is added by toga (gui framework) that probably uses pythonnet (C# port) for handling native windows in Windows.

GUI in this plugin is extraordinary utility, so it should not crash like that (at least not on start).

Could you check if the issue persist if remove gui import in plugin.py? So change this

from gui.options import OPTIONS_MODE

to e.g. this:

OPTIONS_MODE = 'mock'

?

UncleGoogle avatar Mar 21 '21 21:03 UncleGoogle

shared network drive?

nope, D: is my regular old second hard drive

--

yes, removing the import prevents the crash

Fiurgeist avatar Mar 23 '21 19:03 Fiurgeist

nope, D: is my regular old second hard drive

What about %localappdata%, where it is placed? Plugin lives there and the error message say "file:///<...>\humble_f0ca3d80-a432-4d35-a9e3-60f27161ac3a\modules\Python.Runtime.dll" or one of its dependencies.

have you edited this msg? What is under <...> ?

If this is local drive then maybe or one of its dependencies may be the real culprit? I don't know .NET internals to guess what happened.

UncleGoogle avatar Mar 23 '21 21:03 UncleGoogle

%localappdata% is under C:, and C and D are both local drives (I do not have any network drives)

Fiurgeist avatar Mar 24 '21 21:03 Fiurgeist

I'm getting a similar error. I was on 0.7, and just tried to update to 0.9.4, but got the same "plugin has crashed" error.

However, that was with the version I downloaded from GitHub. I removed the plugin and downloaded it from inside the Galaxy UI, and even though it's the same version, it connected fine.

I suspect the plugin was flagged by Windows as from an "internet source" and blocked it. Windows 10 likes to do that now I've noticed.

It might be a different error, but I wanted to mention it anyway.

Gwindalmir avatar May 21 '21 07:05 Gwindalmir

FIX: Go to %LocalAppData%\GOG.com\Galaxy\plugins\installed\humble-...\modules, find the Python.Runtime.dll file, right click and choose Properties. At the bottom, tick the "Unblock" tickbox, click OK.

Works absolutely fine after that :)

recrudesce avatar Sep 28 '22 14:09 recrudesce