Godot: "ERROR: read: Server disconnected!" when using custom accessors in C# (Godot alpha 2, mono)

Created on 20 Nov 2017  路  2Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Operating system: Debian "stretch" 9.2
Linux mhm-pc 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
Godot version: Godot_v3.0-alpha2_mono_x11_64
GPU: NVIDIA Corporation GK208 [GeForce GT 730] (rev a1)
NVIDIA driver version: 375.82

Issue description:

When using custom accessors in C# and then accessing the property, the game does not run and shows the below message:
"ERROR: read: Server disconnected!
At: drivers/unix/stream_peer_tcp_posix.cpp:275."
Also, when using custom accessors and trying to add string in set (e.g. set { team = value + "_team"; }, my system freezes and I have to do manual reset.
The problem resolves when changing to automatic properties (e.g public string team {get; set;}).

Steps to reproduce:

  1. Make class with custom accessors
  2. Access class
  3. Game does not run/crashes on loading and shows above error message.
  1. Use automatic properties instead
  2. Game runs as expected

Video: https://webm.red/nWn7.webm

Link to minimal example project:

Test.zip

Console output: https://hastebin.com/ebusisubew.rb

archived bug mono

Most helpful comment

You are getting a StackOverflowException because of endless recursive calls. That property generates something like this:

``` C#
public string get_team()
{
return get_team();
}

public void set_team(string val)
{
set_team(val/* + "_team"*/);
}


I think you are looking for this (if not automatic properties):

``` C#
private string team;

public string Team
{
    get
    {
        return team;
    }
    set
    {
        team = value/* + "_team"*/;
    }
}

Right now, we only print unhandled exceptions in the terminal. I'll make the editor display them in the future.

All 2 comments

You are getting a StackOverflowException because of endless recursive calls. That property generates something like this:

``` C#
public string get_team()
{
return get_team();
}

public void set_team(string val)
{
set_team(val/* + "_team"*/);
}


I think you are looking for this (if not automatic properties):

``` C#
private string team;

public string Team
{
    get
    {
        return team;
    }
    set
    {
        team = value/* + "_team"*/;
    }
}

Right now, we only print unhandled exceptions in the terminal. I'll make the editor display them in the future.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mefihl picture mefihl  路  3Comments

RebelliousX picture RebelliousX  路  3Comments

nunodonato picture nunodonato  路  3Comments

SleepProgger picture SleepProgger  路  3Comments

Zylann picture Zylann  路  3Comments