Programmable Block compilation error after clean reinstall "member names cannot be the same as the

Red Lesnihii shared this bug 2 days ago
Solved

Game version: Space Engineers (Steam, latest version as of November 2025)

Platform: Windows 10/11

Language: Russian localization

Problem summary:

Programmable Block fails to compile even the most basic script. The error "'Program': member names cannot be the same as their enclosing type" appears regardless of script content.

Steps to reproduce:

  1. Create a new Creative world with "Enable In-Game Scripts" checked
  2. Place a Programmable Block (Программируемый блок автоматона)
  3. Open Edit and paste minimal code:


csharp


public class Program : MyGridProgram { public void Main(string arg) { Echo("Test"); } }


  1. Click "Check code" or "Remember & Exit"
  2. Compilation fails with the error above

What I have already tried:

  • Full game reinstall via Steam (delete + reinstall)
  • Cleared %localappdata%\VRage folder (was not present after reinstall)
  • Created a brand new world with no mods
  • Tested multiple script variations (renamed classes, shortened variables)
  • Verified "Allow In-Game Scripts" is enabled in world settings
  • Ran game as Administrator

Expected behavior:

The minimal script should compile without errors.

Actual behavior:

Any script fails to compile with the same error, even in a fresh world with no mods.

Attachments:

  • Screenshot of the error in Programmable Block editor
  • Screenshot of world settings (showing scripts enabled)
  • List of installed mods (if any were active in other worlds)
  • SpaceEngineers.log file from %appdata%\SpaceEngineers

Replies (3)

photo
1

I am not from Keen. This is normal behavior for a compiler, so I'm not really sure what you are intending to do. The programmable block script already sits inside a MyGridProgram class, so the error message is similar to MyGridProgram:MyGridProgram and the compiler can't tell what you are referencing. Just like in a C# file and you have class aaa { class aaa { } } you get the same compile message because it can't figure out what aaa is supposed to reference. In programmable scripts you don't have to start out with a class statement because its already in a class. Your statement DOES compile if you have public class Program1 : MyGridProgram { public void Main(string arg) { Echo("Test"); } } (note the Program1) because now there is no confusion.

photo
1

Hello Engineer,


We're always grateful for the community helping out their fellow players, thank you very much!


Kind Regards,

Keen Software House: QA Department

photo
photo
1

THANK YOU LETTER TO SPACE ENGINEERS DEVELOPERS


================================================================================


SUBJECT: Re: [BUG] Drone script error - Method must have a return type


================================================================================


Hello Keen Software House team!


Thank you for the quick and helpful response to my bug report!


THE PROBLEM I HAD:

I was getting a compiler error:

"Program(22,1): Error: 'Method must have a return type'"


THE CAUSE (now I understand):

The Programmable Block in Space Engineers automatically wraps all code

in a MyGridProgram class. When I added another MyGridProgram class on top,

it created a nested class with the same name - which is not allowed!


It was like:

class MyGridProgram { class MyGridProgram { } }

← This doesn't work in C#!


THE SOLUTION:

I used a different name for the class:


❌ WRONG:

public class MyGridProgram : MyGridProgram { }


✅ CORRECT:

public class CargoDroneController : MyGridProgram { }


RESULT:

The script now compiles WITHOUT ERRORS! ✅


MY CARGO DRONE IS FULLY FUNCTIONAL:

✅ TAKEOFF command (drone takes off)

✅ LAND command (drone lands)

✅ LOAD command (load cargo)

✅ UNLOAD command (unload cargo + trip counter)

✅ Built-in display shows drone status


APPRECIATION:

Thank you for:

1. Responding quickly to my report

2. Explaining how the Programmable Block compiler works

3. Showing the correct code structure

4. Helping me understand C# syntax properly


Your response really helped me understand the namespace behavior

in Programmable Block and how to properly structure my scripts.


OVERALL OPINION:

Space Engineers is an excellent game! I especially love:

- The ability to write custom scripts

- Active technical support from developers

- Open source code availability

- Wonderful community


Best regards,

Your player from Russia 🇷


================================================================================


P.S. If anyone else encounters this error - the solution is here!

Just use a DIFFERENT class name instead of MyGridProgram!


================================================================================

photo
1

Hello Engineer,


Thank you for reaching out to us on the forum.


As we see that the community already resolved the issue, we will close this ticket. Thank you for letting us know it's been resolved.


Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file