VedalAI / neuro-amongus

Among Us Plugin for Neuro-sama
GNU General Public License v3.0
531 stars 50 forks source link

BUG: Game refuses to close #56

Closed Alexejhero closed 1 year ago

Alexejhero commented 1 year ago

When attempting to close the game, the WebSocketThread for whatever reason does not want to exit so it gets stuck and the game freezes up and crashes.

EBro912 commented 1 year ago

@Alexejhero and I have been scratching our heads about this for a while, we tried disabling both threads and the issue still persists, so the issue may reside somewhere else.

One theory I had is that since both threads use async void, the exceptions the thread relies on to close the socket never actually gets called since C# will ignore and not catch exceptions in an async void. (See here). However, after converting both threads to tasks which should solve this problem, the crashing issue still persists. Therefore as stated previously there is a high chance the problem lies somewhere else, but again we currently have no idea where. Correction, disabling the thread entirely instead of just returning does seem to fix the issue, so the issue probably lies with one of the threads hanging for some reason.