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

.NET 6 - Running exported PCK fails to load scripts or fails to load hostfxr #72159

Open
AlmightyLaxz opened this issue Jan 27, 2023 · 3 comments

Comments

@AlmightyLaxz
Copy link
Contributor

Godot version

v4.0.beta.mono.custom_build [d1e5903] (With precision=double)

System information

Arch Linux, Vulkan

Issue description

After exporting a project as a PCK or ZIP file and trying to run it, I get errors. The error produced seems to vary depending on the engine build target (editor & template_debug tested).

With an editor build, the exported reproduction project runs but the test C# class 'could not be found'.
scons precision=double p=linuxbsd tools=yes module_mono_enabled=yes debug_symbols=yes target=editor vulkan=yes -j 14

./godot.linuxbsd.editor.double.x86_64.mono --main-pack /gd4_export_pck_test/export/test.pck

Godot Engine v4.0.beta.mono.custom_build.d1e5903c6 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2080 SUPER
 
ERROR: Cannot instance script because the associated class could not be found. Script: 'res://tester.cs'. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly (it's case-sensitive).
   at: can_instantiate (modules/mono/csharp_script.cpp:2300)

With a template_debug build, the exported reproduction project fails to load hostfxr:
scons precision=double p=linuxbsd module_mono_enabled=yes target=template_debug -j 14

./godot.linuxbsd.template_debug.double.x86_64.mono --main-pack /gd4_export_pck_test/export/test.pck

Godot Engine v4.0.beta.mono.custom_build.d1e5903c6 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2080 SUPER
 
ERROR: .NET: Failed to load hostfxr
   at: initialize (modules/mono/mono_gd/gd_mono.cpp:394)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.0.beta.mono.custom_build (d1e5903c67956707948b1de370b807e3aad395b7)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x38a00) [0x7fe5506c7a00] (??:0)
-- END OF BACKTRACE --
================================================================
[1]    60688 IOT instruction (core dumped)  ./godot.linuxbsd.template_debug.double.x86_64.mono --main-pack 

Exporting projects as an executable with the template_debug build is working, the problem appears to be specific to PCK & ZIP export.

Steps to reproduce

  1. Open the reproduction project
  2. Open Project>Export and export the project as a PCK or ZIP file (may need to add a new export preset for your platform).
  3. Run an editor or template build with the --main-pack argument as the exported PCK/ZIP file.
    ./godot.linuxbsd.template_debug.double.x86_64.mono --main-pack /gd4_export_pck_test/export/test.pck

Minimal reproduction project

gd4_export_pck_test.zip

@AlmightyLaxz AlmightyLaxz changed the title Master - .NET 6 - Running exported PCK Errors Master - .NET 6 - Running exported PCK fails to load scripts or fails to load at all Jan 27, 2023
@AlmightyLaxz AlmightyLaxz changed the title Master - .NET 6 - Running exported PCK fails to load scripts or fails to load at all Master - .NET 6 - Running exported PCK fails to load scripts or fails to load hostfxr Jan 27, 2023
@akien-mga akien-mga changed the title Master - .NET 6 - Running exported PCK fails to load scripts or fails to load hostfxr .NET 6 - Running exported PCK fails to load scripts or fails to load hostfxr Jan 27, 2023
@akien-mga akien-mga added this to the 4.0 milestone Jan 27, 2023
@RedworkDE
Copy link
Member

Use Export Project... instead of Export PCK/ZIP.... This will emit the folder with the .net runtime and compiled scripts that is required by the exported c# code.

Also I am pretty sure that the editor binary cannot run exported C# projects at all.

@akien-mga
Copy link
Member

It should be fixed, exporting PCK/ZIP should provide a working export with the .NET runtime and scripts, just without the template binary.

@Anixias
Copy link

Anixias commented Feb 20, 2023

Use Export Project... instead of Export PCK/ZIP.... This will emit the folder with the .net runtime and compiled scripts that is required by the exported c# code.

Also I am pretty sure that the editor binary cannot run exported C# projects at all.

In my case, I do use Export Project... and it still fails to load hostfxr on the exported executable. See my other comment on a similar issue for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To Assess
Development

No branches or pull requests

5 participants