Giter Club home page Giter Club logo

Comments (3)

Jakob-PB avatar Jakob-PB commented on May 29, 2024

After some further testing it seems that these problems might have something to do with moving C# scripts around. If I open up the project, move a C# file to another folder, press "Reload All" when prompted, and then press "Play in Editor" it will usually (but not 100% reproducibly) either crash the Godot editor or show the "No Godot editor instance connected" error alert popup. If it doesn't crash but only gives the "No Godot editor instance connected" popup then "Play in Editor" will usually start working again after a second try.

Also here's another error that I received in the console during one of the connection failures:

ERROR: godot_icall_GD_pusherror: Unhandled exception in the peer loop
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.NetworkStream'.
  at System.Net.Sockets.NetworkStream.EndRead (System.IAsyncResult asyncResult) [0x00015] in <1b258c66af934287ab0304649d81ba79>:0
  at System.IO.Stream+<>c.<BeginEndReadAsync>b__45_1 (System.IO.Stream stream, System.IAsyncResult asyncResult) [0x00000] in <34e7ab706f1141f9b981d74fbe2f5560>:0
  at System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1[TResult,TInstance].Complete (TInstance thisRef, System.Func`3[T1,T2,TResult] endMethod, System.IAsyncResult asyncResult, System.Boolean requiresSynchronization) [0x00000] in <34e7ab706f1141f9b981d74fbe2f5560>:0
--- End of stack trace from previous location where exception was thrown ---

  at System.IO.StreamReader.ReadBufferAsync () [0x001e0] in <34e7ab706f1141f9b981d74fbe2f5560>:0
  at System.IO.StreamReader.ReadLineAsyncInternal () [0x00093] in <34e7ab706f1141f9b981d74fbe2f5560>:0
  at GodotTools.IdeMessaging.Peer.ReadLine () [0x000b0] in <22b1cc7a6c9542d4958cd3d1d92a6515>:0
  at GodotTools.IdeMessaging.Peer.Process () [0x0033a] in <22b1cc7a6c9542d4958cd3d1d92a6515>:0
   At: modules/mono/glue/gd_glue.cpp:250

from godot-csharp-visualstudio.

GeorgeS2019 avatar GeorgeS2019 commented on May 29, 2024

Anyone has figured out how to address this? @neikeq This is the MOST common problem

from godot-csharp-visualstudio.

kwas-123 avatar kwas-123 commented on May 29, 2024

I solved this by adding two delays inside OnRun in the file Debugging\GodotDebuggerSession.cs

I think a single 400 ms delay (in the first instruction, removing the second one) would also work.
If I only have 200 ms delay the problem still happens but with two it goes away.
Note that the 'glitch' that occurs when you do not delay can throw the editor into a funny state as far as debugging connections are concerned. So, after recompiling and reinstalling the vsix, you have to restart the editor.
I think PC speed will matter but for me, the following totally eliminates the problem.
So far I do not get the "no instance connected" issue and also I don't get godot editor shutdowns (though I only tested 10 minutes).

The problem seems to be on VS side. Godot responds to the connection each time normally and fast, but the glitch happens when the VS side says we're not connected when godot thinks we are.

StartListening(godotStartInfo, out var assignedDebugPort); Thread.Sleep(200); var godotMessagingClient = GodotPackage.Instance.GodotSolutionEventsListener?.GodotMessagingClient; Thread.Sleep(200); if (godotMessagingClient == null)

from godot-csharp-visualstudio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.