Hello,

It's been a day now that I'm trying to fix my problem. I followed the tutorial on the document about saving data to a file.

I tried in different ways but I still have this error:

Even without writing to a file I have this error. I also tried to write in godot console by sending him the dictionary directly. Here is my code:

Sorry for my English.

@Scozor said: Hello,

It's been a day now that I'm trying to fix my problem. I followed the tutorial on the document about saving data to a file.

I tried in different ways but I still have this error:

I'm not sure on the error, as it I am fairly certain stream_peer_tcp_winstock relates to networking, or at least I think that is what it does. Does the error prevent the project from running?

Even without writing to a file I have this error. I also tried to write in godot console by sending him the dictionary directly. Here is my code:

One problem could be that you are not closing the file.

After saveGame.StoreLine(JSON.Print(test)); you should add saveGame.Close() so there are no memory leaks. I think saveGame.close is when Godot saves the data to the file, though I could be wrong.


Hopefully this helps :smile:

Sorry, I had removed file.Close () to test and forgot to put it back before the screen. It does not work.

The game closes when I call my SaveGame () method.

Here is a screen, exactly the same way as the example of the documentation and it still does not work with the same error in exit.

I forgot to tell you that if I replace my code saveGame.StoreLine (JSON.Print (nodeData)); by saveGame.StoreLine ("Test")); it works.

Giving that saveGame.StoreLine works, I think the problem is either JSON.print not working, or converting nodeData to JSON is not working.

I have not used the C# version of Godot just yet, but later I will download it, set it up, and see what happens. Right now I am a little busy, but I will try to get everything up and make a test C# project sometime soon, hopefully before Thanksgiving.

Actually I also thought it came from JSON.

Thank you for your reply :)

After some work, I finally got my build environment setup, Mono 5.12.0 installed, and a sample project made. I get a similar issue on Linux, with the project crashing and giving the following error:

drivers/unix/stream_peer_tcp_posix.cpp:276 - Server disconnected!

I looked at the file and it seems stream_peer_tcp_posix.cpp relates to converting a Dictionary to a JSON string. I tried change the line that read JSON.print(node_data) to JSON.print("TEST") and it works fine. Whenever you pass a Dictionary though, regardless of how the dictionary is setup, the project crashes.

I am pretty sure this is a C# related bug. I looked through the issues on the GitHub repository, and I could not find any open issues relating to this bug, so I created a new issue on the GitHub repository.

I guess now all that is left is to wait and see what happens :smile:

Okay thank you :)

It seemed to me that the problem came from the dictionaries and not from me.

a year later

try IDictionary ...the difference is that Dictionary is concrete implementation while IDictionary is just a contract, abstraction. If IDictionary is a "more generic" type than Dictionary then it makes sense to use the more generic type in declaring variables. It is a good idea to abstract yourself from an implementation, by that I mean programming against an interface rather than a concrete implementation.

3 years later