raulsntos / godot-dotnet

MIT License
86 stars 13 forks source link

Cannot RegisterClass CustomNode #2

Closed ZerxZ closed 2 months ago

ZerxZ commented 7 months ago

Godot version

Godot v4.3.dev5

Godot .NET packages version

Godot v4.3.dev5.mono

System information

Windows 10.0.22000 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.5123) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

.NET information

8.0.202

Issue description

Cannot RegisterClass CustomNode

Steps to reproduce

Build Sample Summator

Minimal reproduction project

CustomNodeMRP.zip

raulsntos commented 6 months ago

Can you describe the error in more detail? For example, are you getting any errors? Also, please try with the latest nightly packages (version is 4.3.0-nightly.24260.1), I've recently fixed some marshalling/memory issues so if it was related maybe it solved your issue.

ZerxZ commented 6 months ago

@raulsntos This PR has been fixed #3 . image https://github.com/raulsntos/godot-dotnet/blob/3e6de8d604389eec0f886b08d61a2a0507921d91/src/Godot.Bindings/NativeInterop/Marshalling.Ptr.cs#L12

Here the value parameter of the function may have a null value causing a crash. This makes it impossible to register a Node or to register other types.


Just tried building with version 4.3.0-nightly.24260.1. Still failing and still flashing and crashing.

Error Log:

Godot Engine v4.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 551.23 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

Project is missing: D:/Godot/Projects/c#-testmethod/project.godot
Editing project: C:/VCS/godot-dotnet/samples/Summator/Game
Godot Engine v4.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
Vulkan 1.3.271 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.3.dev.mono.custom_build (7ebc866418b075df58cbe4e31fcf8b0c3acd70a1)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
[21] error(-1): no debug info in PE/COFF executable
[22] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================
raulsntos commented 6 months ago

Thanks for the detailed report.

I wonder what's the type T when the crash happens, unfortunately the error log doesn't provide much information. There were some recent fixes for nullable values when T is Array, Dictionary or StringName. The only other type that could be null there are the Packed Arrays, I'm not currently checking if those are null, I'm not sure if it's valid to receive null Packed Arrays in this method.

ZerxZ commented 6 months ago

Thanks for the detailed report.

I wonder what's the type T when the crash happens, unfortunately the error log doesn't provide much information. There were some recent fixes for nullable values when T is Array, Dictionary or StringName. The only other type that could be null there are the Packed Arrays, I'm not currently checking if those are null, I'm not sure if it's valid to receive null Packed Arrays in this method.

I tried changing it to build the same as that pr with the latest branch, but it seems to be failing. Not sure what's wrong there now.


Godot Engine v4.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
NVAPI: Init OK!
NVAPI: Disabled OpenGL threaded optimization successfully
Using "winink" pen tablet driver...
Shader 'CanvasSdfShaderGLES3' SHA256: 9e49c088039e269f10d3d99ed70967401444f46d90da802332464c90936efaec
Shader 'SkeletonShaderGLES3' SHA256: 1c3ff5cf5fdf77893eb39778dec9921594358266dc68a4a65fb894a0bb89c0f2
Shader 'ParticlesShaderGLES3' SHA256: 08a105174b8df5e7f27de9be34b26cf2333faee0d4ad521c4e330a0315032416
Shader 'ParticlesCopyShaderGLES3' SHA256: e4ca588ac48bb973c519d0fd3fb4b8394c62bf997da1610939b39ccfe25cf44b
Shader 'CopyShaderGLES3' SHA256: c8ae995e2abbb5157b34c2ca05f077afc61131fc013b659229be4e5bea47e4b3
Shader 'CubemapFilterShaderGLES3' SHA256: bb13a19d685829d8c0d1e83be1b8f229c6c4acf2996f5e8fc38815be2d3724de
Shader 'GlowShaderGLES3' SHA256: 2584e56f263d9a029b1dc464f86def6bc876e58dc4ee1ae0081aee19f725f526
Shader 'PostShaderGLES3' SHA256: dda70b1b5bb2d96e6926f3ec38eca5e5c6f67fbd3f26cf9f053e4b32e8eecbda
Shader 'CanvasShaderGLES3' SHA256: b65bd6f810f1e66afc5976b9398f4abd0c493ff616cc5ba4d9191bc00d423d49
Shader 'CanvasOcclusionShaderGLES3' SHA256: 73608abbc6f544867458a32fc9b9d265ece0a5d51854d0de4add67ee8c891269
Shader 'SceneShaderGLES3' SHA256: c1a653eb9e2b68ba0ba50accb71a95ff5dfa7fc73a8e7ecd1dec1435e3d67cbd
Shader 'SkyShaderGLES3' SHA256: 1fb5797d169385c993a64c4cafb31b3503d9c616fe75581dedfb4c00c1cf1393
OpenGL API 3.3.0 NVIDIA 551.23 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 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.4/hostfxr.dll
.NET: hostfxr initialized
.NET: GodotPlugins initialized
CORE API HASH: 2487118531
EDITOR API HASH: 1392961945
EditorSettings: Load OK!
EditorTheme: Generating new theme for the config '66886095'.
EditorTheme: Generating new icons.
EditorTheme: Generating new fonts.
EditorTheme: Generating new styles.
Project is missing: D:/Godot/Projects/c#-testmethod/project.godot
Loaded system CA certificates
EditorSettings: Save OK!
Editing project: C:/VCS/godot-dotnet/samples/Summator/Game
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.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
Orphan StringName: EditorFileDialog (static: 1, total: 7)
Orphan StringName: AudioStream (static: 0, total: 1)
Orphan StringName: ItemList (static: 1, total: 9)
Orphan StringName: TabBar (static: 1, total: 9)
Orphan StringName: FileDialog (static: 1, total: 7)
Orphan StringName: AudioStreamRandomizer (static: 0, total: 4)
Orphan StringName: OptionButton (static: 1, total: 11)
Orphan StringName: Texture2D (static: 0, total: 5)
Orphan StringName: PopupMenu (static: 1, total: 15)
StringName: 9 unclaimed string names at exit.
Vulkan 1.3.271 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

Process is terminating due to StackOverflowException.

Just saw that you fixed the stack overflow in GodotObject.PropertyCanRevert. But the null problem is still there.

image

Godot Engine v4.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
NVAPI: Init OK!
NVAPI: Disabled OpenGL threaded optimization successfully
Using "winink" pen tablet driver...
Shader 'CanvasSdfShaderGLES3' SHA256: 9e49c088039e269f10d3d99ed70967401444f46d90da802332464c90936efaec
Shader 'SkeletonShaderGLES3' SHA256: 1c3ff5cf5fdf77893eb39778dec9921594358266dc68a4a65fb894a0bb89c0f2
Shader 'ParticlesShaderGLES3' SHA256: 08a105174b8df5e7f27de9be34b26cf2333faee0d4ad521c4e330a0315032416
Shader 'ParticlesCopyShaderGLES3' SHA256: e4ca588ac48bb973c519d0fd3fb4b8394c62bf997da1610939b39ccfe25cf44b
Shader 'CopyShaderGLES3' SHA256: c8ae995e2abbb5157b34c2ca05f077afc61131fc013b659229be4e5bea47e4b3
Shader 'CubemapFilterShaderGLES3' SHA256: bb13a19d685829d8c0d1e83be1b8f229c6c4acf2996f5e8fc38815be2d3724de
Shader 'GlowShaderGLES3' SHA256: 2584e56f263d9a029b1dc464f86def6bc876e58dc4ee1ae0081aee19f725f526
Shader 'PostShaderGLES3' SHA256: dda70b1b5bb2d96e6926f3ec38eca5e5c6f67fbd3f26cf9f053e4b32e8eecbda
Shader 'CanvasShaderGLES3' SHA256: b65bd6f810f1e66afc5976b9398f4abd0c493ff616cc5ba4d9191bc00d423d49
Shader 'CanvasOcclusionShaderGLES3' SHA256: 73608abbc6f544867458a32fc9b9d265ece0a5d51854d0de4add67ee8c891269
Shader 'SceneShaderGLES3' SHA256: c1a653eb9e2b68ba0ba50accb71a95ff5dfa7fc73a8e7ecd1dec1435e3d67cbd
Shader 'SkyShaderGLES3' SHA256: 1fb5797d169385c993a64c4cafb31b3503d9c616fe75581dedfb4c00c1cf1393
OpenGL API 3.3.0 NVIDIA 551.23 - Compatibility - Using Device: NVIDIA - NVIDIA GeForce RTX 3070 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.4/hostfxr.dll
.NET: hostfxr initialized
.NET: GodotPlugins initialized
CORE API HASH: 2487118531
EDITOR API HASH: 1392961945
EditorSettings: Load OK!
EditorTheme: Generating new theme for the config '66886095'.
EditorTheme: Generating new icons.
EditorTheme: Generating new fonts.
EditorTheme: Generating new styles.
Project is missing: D:/Godot/Projects/c#-testmethod/project.godot
Loaded system CA certificates
EditorSettings: Save OK!
Editing project: C:/VCS/godot-dotnet/samples/Summator/Game
EditorSettings: Save OK!
Unloading: Disposing tracked instances...
Godot Engine v4.3.dev.mono.custom_build.7ebc86641 (2024-05-04 09:52:45 UTC) - https://godotengine.org
Unloading: Finished disposing tracked instances.
XR: Clearing primary interface
XR: Removed interface "Native mobile"
XR: Removed interface "OpenXR"
Orphan StringName: EditorFileDialog (static: 1, total: 7)
Orphan StringName: AudioStream (static: 0, total: 1)
Orphan StringName: ItemList (static: 1, total: 9)
Orphan StringName: TabBar (static: 1, total: 9)
Orphan StringName: FileDialog (static: 1, total: 7)
Orphan StringName: AudioStreamRandomizer (static: 0, total: 4)
Orphan StringName: OptionButton (static: 1, total: 11)
Orphan StringName: Texture2D (static: 0, total: 5)
Orphan StringName: PopupMenu (static: 1, total: 15)
StringName: 9 unclaimed string names at exit.
Vulkan 1.3.271 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3070 Laptop GPU

System.ArgumentNullException: Cannot marshal null value of type Godot.Collections.PackedStringArray. (Parameter 'value')
System.ArgumentNullException: Cannot marshal null value of type Godot.Collections.PackedStringArray. (Parameter 'value')
raulsntos commented 2 months ago

The Packed Array marshalling issue should be fixed by b62bb9c71c027193f6ef09d5c7028360f66c38ec. Are there any other issues reported here or can it be closed?

ZerxZ commented 2 months ago

My simple test did solve the inheritance problem. But I'm not sure about the rest. I've solved the problem by turning off the Issues.The version tested was v4.3.stable.mono.