godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.87k stars 21.14k forks source link

Crashes when building project with C# script #88372

Open daLoneDrau opened 8 months ago

daLoneDrau commented 8 months ago

Tested versions

Reproducible in v4.2.1.stable.mono.official [b09f793f5]

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA RTX 3500 Ada Generation Laptop GPU (NVIDIA; 31.0.15.2919) - 13th Gen Intel(R) Core(TM) i9-13950HX (32 Threads)

Issue description

Clicking the Run button or pressing F5 causes a dialog with "Building .NET project" to appear. The dialog never goes away, and Godot is no longer responsive. Need to kill the application.

Steps to reproduce

This can be reproduced by clicking the Run button or press F5 to run. Also by going to the MSBuild menu and click the Build button. Choose "Build Project". Choosing "Clean Project" however never caused a crash.

Minimal reproduction project (MRP)

Was able to reproduce the error using the attached project. Reproducible using the steps above.

MRP.zip

GumaD3v commented 8 months ago

Cannot reproduce: project compiles and runs just fine.

raulsntos commented 8 months ago

I also can't reproduce on Linux, it may be Windows-specific.

Are there any messages in the console when building from Godot? Try running the Godot editor in verbose mode:

godot --verbose

What happens if you try to build the project from outside Godot? Try using this command from the terminal:

dotnet build --no-restore --no-incremental -c Debug
paulloz commented 8 months ago

I also can't reproduce on Linux, it may be Windows-specific.

Cannot reproduce on Win10.

daLoneDrau commented 8 months ago

Thank you for looking into my issue. I ran the console.exe using the verbose command. I received a warning and an error when opening the project:

Godot Engine v4.2.1.stable.mono.official.b09f793f5 - https://godotengine.org TextServer: Added interface "Dummy" TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)" Native OpenGL API detected: 3.3: NVIDIA - NVIDIA RTX 3500 Ada Generation Laptop GPU NVAPI: Init OK! NVAPI: Disabled OpenGL threaded optimization successfully Using "winink" pen tablet driver... Shader 'CanvasSdfShaderGLES3' SHA256: cd1c0492414d766a453a85fad4eca205a778843c0ed4d38d362ff4fa54e49499 Shader 'SkeletonShaderGLES3' SHA256: b73a53e47f62fa795d54bb1f6fc59053d4fb58b68a5ebba291647110b2496120 Shader 'ParticlesShaderGLES3' SHA256: e835562a9ae4fe1c55a90b76979674a9a34735e256da0f6551264d6e2e8134bc Shader 'ParticlesCopyShaderGLES3' SHA256: e1448117caeaf99908fe48f9801ccd9084d420fc432231522f003dcda4ccd2e0 Shader 'CopyShaderGLES3' SHA256: bb455e09331862e1b35aeab4c5f08f77650e541883cfc56753ee3e34fa48f915 Shader 'CanvasShaderGLES3' SHA256: 0418c454f88af4c1763f333fa0b08cad530d5b13333cf3114c32597df76dd0e4 Shader 'CanvasOcclusionShaderGLES3' SHA256: d48935fcb33ff7cf0fc6f98986d2d6ae99724868303fa2d00f4d6b370d1dfcb8 Shader 'SceneShaderGLES3' SHA256: 84e164702c75f95b3f5316d44eb20ab01828482be8404887c49a4f6f06246836 Shader 'SkyShaderGLES3' SHA256: 3a57c0c88b45720219c8974db0c71dfd3aa1dfa0430d41f6705e3f61e905326f Shader 'CubemapFilterShaderGLES3' SHA256: 2505da09d7286bd186d09ab6397fb0ccda3507911a3318061cb9cc3fa07c24cd OpenGL API 3.3.0 NVIDIA 529.19 - Compatibility - Using Device: NVIDIA - NVIDIA RTX 3500 Ada Generation Laptop GPU WASAPI: Activated output_device using IAudioClient3 interface WASAPI: wFormatTag = 65534 WASAPI: nChannels = 2 WASAPI: nSamplesPerSec = 48000 WASAPI: nAvgBytesPerSec = 384000 WASAPI: nBlockAlign = 8 WASAPI: wBitsPerSample = 32 WASAPI: cbSize = 22 WASAPI: mix_rate = 48000 WASAPI: fundamental_period_frames = 480 WASAPI: min_period_frames = 480 WASAPI: max_period_frames = 480 WASAPI: selected a period frame size of 480 WASAPI: detected 2 channels WASAPI: audio buffer frames: 480 calculated latency: 10ms

TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)". .NET: Initializing module... Found hostfxr: C:\Program Files\dotnet\host/fxr/8.0.1/hostfxr.dll .NET: hostfxr initialized .NET: GodotPlugins initialized CORE API HASH: 2728314392 EDITOR API HASH: 3722019024 EditorSettings: Load OK! Loaded system CA certificates EditorSettings: Save OK! Editing project: C:/Users/588648/workspace_godot/MRP EditorSettings: Save OK! Unloading: Disposing tracked instances... Unloading: Finished disposing tracked instances. XR: Clearing primary interface XR: Removed interface "Native mobile" XR: Removed interface "OpenXR" Godot Engine v4.2.1.stable.mono.official.b09f793f5 - https://godotengine.org TextServer: Added interface "Dummy" TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)" Native OpenGL API detected: 3.3: NVIDIA - NVIDIA RTX 3500 Ada Generation Laptop GPU NVAPI: Init OK! NVAPI: Disabled OpenGL threaded optimization successfully Using "winink" pen tablet driver... Shader 'CanvasSdfShaderGLES3' SHA256: cd1c0492414d766a453a85fad4eca205a778843c0ed4d38d362ff4fa54e49499 Shader 'SkeletonShaderGLES3' SHA256: b73a53e47f62fa795d54bb1f6fc59053d4fb58b68a5ebba291647110b2496120 Shader 'ParticlesShaderGLES3' SHA256: e835562a9ae4fe1c55a90b76979674a9a34735e256da0f6551264d6e2e8134bc Shader 'ParticlesCopyShaderGLES3' SHA256: e1448117caeaf99908fe48f9801ccd9084d420fc432231522f003dcda4ccd2e0 Shader 'CopyShaderGLES3' SHA256: bb455e09331862e1b35aeab4c5f08f77650e541883cfc56753ee3e34fa48f915 Shader 'CanvasShaderGLES3' SHA256: 0418c454f88af4c1763f333fa0b08cad530d5b13333cf3114c32597df76dd0e4 Shader 'CanvasOcclusionShaderGLES3' SHA256: d48935fcb33ff7cf0fc6f98986d2d6ae99724868303fa2d00f4d6b370d1dfcb8 Shader 'SceneShaderGLES3' SHA256: 84e164702c75f95b3f5316d44eb20ab01828482be8404887c49a4f6f06246836 Shader 'SkyShaderGLES3' SHA256: 3a57c0c88b45720219c8974db0c71dfd3aa1dfa0430d41f6705e3f61e905326f Shader 'CubemapFilterShaderGLES3' SHA256: 2505da09d7286bd186d09ab6397fb0ccda3507911a3318061cb9cc3fa07c24cd OpenGL API 3.3.0 NVIDIA 529.19 - Compatibility - Using Device: NVIDIA - NVIDIA RTX 3500 Ada Generation Laptop GPU WASAPI: Activated output_device using IAudioClient3 interface WASAPI: wFormatTag = 65534 WASAPI: nChannels = 2 WASAPI: nSamplesPerSec = 48000 WASAPI: nAvgBytesPerSec = 384000 WASAPI: nBlockAlign = 8 WASAPI: wBitsPerSample = 32 WASAPI: cbSize = 22 WASAPI: mix_rate = 48000 WASAPI: fundamental_period_frames = 480 WASAPI: min_period_frames = 480 WASAPI: max_period_frames = 480 WASAPI: selected a period frame size of 480 WASAPI: detected 2 channels WASAPI: audio buffer frames: 480 calculated latency: 10ms

TextServer: Primary interface set to: "ICU / HarfBuzz / Graphite (Built-in)". .NET: Initializing module... Found hostfxr: C:\Program Files\dotnet\host/fxr/8.0.1/hostfxr.dll .NET: hostfxr initialized .NET: GodotPlugins initialized CORE API HASH: 2728314392 EDITOR API HASH: 3722019024 EditorSettings: Load OK! WARNING: Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported. at: _editor_init (modules/gltf/register_types.cpp:63) Found .NET Sdk version '8.0.101': C:\Program Files\dotnet\sdk\8.0.101 Loaded system CA certificates Failed to bind socket. Error: 3 Failed to bind socket. Error: 3 EditorSettings: Save OK! ERROR: GL ERROR: Source: OpenGL Type: Undefined behavior ID: 131222 Severity: Medium Message: Program undefined behavior warning: The current GL state uses a sampler (0) that has depth comparisons enabled, with a texture object (1020) with a depth format, by a shader that samples it with a non-shadow sampler. Using this state to sample would result in undefined behavior at: _gl_debug_print (drivers/gles3/rasterizer_gles3.cpp:176)

Godot looked okay when running and would allow me to edit the project, but when I tried to run the project this was the last output I received. It never ran and the Godot window stopped responding.

Running: "C:\Program Files\dotnet\dotnet.EXE" build C:/Users/6498267/workspace_godot/MRP/Mrp.csproj -c Debug -v normal "-l:GodotTools.BuildLogger.GodotBuildLogger,C:/Program Files/Godot 4/Godot 4.2.1/GodotSharp/Tools\GodotTools.BuildLogger.dll;C:/Users/588648/AppData/Roaming/Godot/mono/build_logs\6a35dc9a73ea46d17ead8b1630339770_Debug" -p:GodotTargetPlatform=windows

While Godot was stalled trying to run the project I eventually opened another powershell window and ran the dotnet command to build it, and it looked successful:

PS C:\Users\6498267\workspace_godot\MRP> dotnet build --no-restore --no-incremental -c Debug MSBuild version 17.8.3+195e7f5a3 for .NET Mrp -> C:\Users\588648\workspace_godot\MRP.godot\mono\temp\bin\Debug\Mrp.dll

Build succeeded. 0 Warning(s) 0 Error(s)

Thank you.

GumaD3v commented 8 months ago

Have you tried reinstalling godot and visual studio? Does a similar problem appear while using GDScript?

daLoneDrau commented 8 months ago

I tried re-installing Godot and VSCode. It worked for awhile but then the crash started again.

Switched to GDScript, and worked fine, but I'd rather work in C#.

GumaD3v commented 8 months ago

Try reinstalling the .NET SDK and check if the issue gets fixed. (https://dotnet.microsoft.com/download)

daLoneDrau commented 8 months ago

I reinstalled the .NET SDK. That was more reliable, but still experiencing crashes.

roookeee commented 7 months ago

Are you by chance building and running Godot from a HDD? I was running into weird editor crashes as well and found https://github.com/godotengine/godot/issues/67499 which talks about a potential Windows DLL loading race condition which might get triggered more easily when running from slow hard drives - this is a pretty wild guess though :)

Just a wild guess, but multiple people can't reproduce so taking a look at hardware differences might help - your NVIDIA driver is also quite old (529.19 - 31.10.2023)