[.NET6] Webscoekts issue
Ponita0 opened this issue · 2 comments
When using on .NET6 It does stack overflow exception when league client opens or closes when the app is opened.
Possible fixes
-
I tried to remove the line which connects to the websocket
socketConnection.Send($"[5, \"OnJsonApiEvent\"]");
and it worked but no websockets support then. -
Another possible fix is by waiting till the client is fully open and then send the subscribe string and send unsubscribe before the app closes
Listening for process startups requires admin privilege, see https://stackoverflow.com/a/972067/1275774.
@MingweiSamuel implemented a watcher for the lock file, which I don't think requires any special privileges: https://github.com/MingweiSamuel/Camille/blob/release/3.x.x/src/Camille.Lcu/src/AutomaticLockfileProvider.cs
Another alternative is checking the lock file and port every 5 seconds or so, waiting for the client to start.
I've not implemented anything like that in my lib as it's subscribing to the individual events instead of the entire OnJsonApiEvent
and would have to re-subscribe everything. It'd also have to handle account changes somehow. I do have an event for when the client process exits.
The problem exists only when
Subscribed to events and running on .NET6 and
client opens/closes
Other than that it works.
Tried to comment out the socketConnection.send line and it worked decently.
When i uncommented it and ran the app
If league is already on, everything is ok
If its not on, it'll listen for it, after it's on the lib detects that it's on and starts listening to the events, then it stack overflows