Open DevSavvySerge opened 3 months ago
Is xUnit officially supported in any way? This doesn't seem like a Godot issue necessarily
Be it xUnit or any other framework (but Godot?), the issue actually is you cannot create Node2d based objects which makes it impossible for running some tests automatically.
Are you running the code from within Godot? Or as a separate application?
As a separate application. To my current knowledge, the only way to run code from within Godot is to actually run a scene.
It is not possible to run Godot code as an isolated application, see https://github.com/godotengine/godot/issues/92906#issuecomment-2156129842
This might be something to document
Would the only solution be to create a scene and trigger tests from within? Meaning creating some kind of tests runner running within godot?
Indeed, the C# bindings are just bindings, all the background code is run in c++ within the engine, with a few exceptions all the classes in C# are just calling engine methods to do the work, there's no version of the engine written in C# directly
Ok, thank you for the quick answer. That is important knowledge to start with.
Let's see if the dotnet team thinks this should be documented more clearly, but moving this to the documentation repo as it's a documentation issue and not part of the class reference
@DevSavvySerge , do you have a simple example of executing that C# code in a unit test? We're having the same issue here, I understand the problem, but I don't know how to fix it yet lol.
Tested versions
System information
Windows 10 - Godot 4.2.2
Issue description
System.AccessViolationException when creating a new Node2D in a unit test with xUnit
Description
When running a simple unit test using xUnit that creates a new instance of
Node2D
, the test host process crashes with aSystem.AccessViolationException
. This issue occurs consistently and seems to indicate memory corruption.Reproducibility
100% - The error occurs every time the test is run.
Additional Information
Node2D
).Steps to reproduce
Steps to Reproduce
Create a new project in Godot.
Add a C# script file named
UnitTest1.cs
with the following code:Run the unit test using the
dotnet test
command.Expected Result
The test should pass without any exceptions.
Actual Result
The test host process crashes with the following error:
Minimal reproduction project (MRP)
N/A