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

Wrong signal function suggested to the wrong programming language. #65844

Closed
ghost opened this issue Sep 15, 2022 · 1 comment
Closed

Wrong signal function suggested to the wrong programming language. #65844

ghost opened this issue Sep 15, 2022 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Sep 15, 2022

Godot version

3.5.stable.mono

System information

Fedora 35, Mesa Intel HD Graphics

Issue description

I use C# as my main programming language on Godot. I have been following the https://docs.godotengine.org/en/stable/getting_started/first_3d_game/index.html "Your First 3D Game" tutorial and I have found a bug in the engine (and a typo in the documentation).
Please, take a look at this picture.
Screenshot from 2022-09-15 20-20-02
As you might notice, the documentation states that the "_on_MobTimer_timeout()" function will be returned, and, indeed it is returned. Now what's wrong, is that it assumes you are using GDscript. The same happens in the engine:
Screenshot from 2022-09-15 20-25-59
Screenshot from 2022-09-15 20-26-58
As you can see, a GDScript function is returned into the C# script. The user will automatically assume that the engine has given the right function to be used in the script. Now, when used, the function will give an error:
Screenshot from 2022-09-15 20-27-55

Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 9/15/2022 8:27:09 PM.
     1>Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" on node 1 (Restore target(s)).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Debug|Any CPU".
       _GetAllRestoreProjectPathItems:
         Determining projects to restore...
       Restore:
         Committing restore...
         Assets file has not changed. Skipping assets file writing. Path: /home/star-galaxy/Documents/squash_the_creeps/.mono/temp/obj/project.assets.json
         Restored /home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj (in 343 ms).
         
         NuGet Config files used:
             /home/star-galaxy/.nuget/NuGet/NuGet.Config
         
         Feeds used:
             https://api.nuget.org/v3/index.json
         All projects are up-to-date for restore.
     1>Done Building Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" (Restore target(s)).
   1:2>Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" on node 1 (Build target(s)).
     1>ValidateSolutionConfiguration:
         Building solution configuration "Debug|Any CPU".
   1:2>Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" (1:2) is building "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj" (2:6) on node 1 (default targets).
     2>GenerateTargetFrameworkMonikerAttribute:
       Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
       CoreGenerateAssemblyInfo:
       Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
       CoreCompile:
         /usr/lib64/dotnet/dotnet exec "/usr/lib64/dotnet/sdk/6.0.108/Roslyn/bincore/csc.dll" /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /warn:4 /define:GODOT;GODOT_X11;GODOT_PC;TRACE;TOOLS;DEBUG;NETFRAMEWORK;NET472;NET20_OR_GREATER;NET30_OR_GREATER;NET35_OR_GREATER;NET40_OR_GREATER;NET45_OR_GREATER;NET451_OR_GREATER;NET452_OR_GREATER;NET46_OR_GREATER;NET461_OR_GREATER;NET462_OR_GREATER;NET47_OR_GREATER;NET471_OR_GREATER;NET472_OR_GREATER /highentropyva+ /reference:/home/star-galaxy/Documents/squash_the_creeps/.mono/assemblies/Debug/GodotSharp.dll /reference:/home/star-galaxy/Documents/squash_the_creeps/.mono/assemblies/Debug/GodotSharpEditor.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/mscorlib.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Core.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Data.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Drawing.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.IO.Compression.FileSystem.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Numerics.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Runtime.Serialization.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Xml.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/System.Xml.Linq.dll /reference:/home/star-galaxy/.nuget/packages/microsoft.netframework.referenceassemblies.net472/1.0.2/build/.NETFramework/v4.7.2/Facades/netstandard.dll /debug+ /debug:portable /filealign:512 /optimize- /out:"/home/star-galaxy/Documents/squash_the_creeps/.mono/temp/obj/Debug/Squash the Creeps (3D).dll" /subsystemversion:6.00 /target:library /warnaserror- /utf8output /deterministic+ /langversion:7.3 /analyzerconfig:"/home/star-galaxy/Documents/squash_the_creeps/.mono/temp/obj/Debug/Squash the Creeps (3D).GeneratedMSBuildEditorConfig.editorconfig" Main.cs Mob.cs Player.cs "/home/star-galaxy/Documents/squash_the_creeps/.mono/temp/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" "/home/star-galaxy/Documents/squash_the_creeps/.mono/temp/obj/Debug/Squash the Creeps (3D).AssemblyInfo.cs" /warnaserror+:NU1605
     2>/home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS8370: Feature 'top-level statements' is not available in C# 7.3. Please use language version 9.0 or greater. [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]
     2>/home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS8803: Top-level statements must precede namespace and type declarations. [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]
     2>/home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS0106: The modifier 'private' is not valid for this item [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]
         CompilerServer: server - server processed compilation - bd2fa442-b83a-4cc9-b048-236deb1f4723
     2>Done Building Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj" (default targets) -- FAILED.
     1>Done Building Project "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" (Build target(s)) -- FAILED.

Build FAILED.

       "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).sln" (Build target) (1:2) ->
       "/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj" (default target) (2:6) ->
       (CoreCompile target) -> 
         /home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS8370: Feature 'top-level statements' is not available in C# 7.3. Please use language version 9.0 or greater. [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]
         /home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS8803: Top-level statements must precede namespace and type declarations. [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]
         /home/star-galaxy/Documents/squash_the_creeps/Main.cs(37,1): error CS0106: The modifier 'private' is not valid for this item [/home/star-galaxy/Documents/squash_the_creeps/Squash the Creeps (3D).csproj]

    0 Warning(s)
    3 Error(s)

The user will be clueless as to why this error has been given since it was supposed that the engine AND the documentation have given the right function. Instead of being "private void _on_MobTimer_timeout()" AND outside the main class, it should have been "public void OnMobTimerTimeout()" and appended inside the main class.

Now, I understand some of you might say "its a missing feature, not a bug" well it's a bug because this version I'm using explicitly supported C# and is suggesting the function to the user all by itself which the user will assume is right. Some of you might say "this is unnecessary".. it is necessary because this is a C# version that is advertised, both in the engine itself and in the documentation as the equivalent to GDscript so it deserves the same support in it's own version in the engine as GDscript gets.

Steps to reproduce

  1. Add any node that is capable of sending a signal to the scene.
  2. Connect a signal from that node to another node that has a C# script attached to it.
  3. The result will be a GDscript function appended into a C# script.

Minimal reproduction project

No response

@KoBeWi
Copy link
Member

KoBeWi commented Sep 15, 2022

Duplicate of #18721

@KoBeWi KoBeWi marked this as a duplicate of #18721 Sep 15, 2022
@KoBeWi KoBeWi closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant