Ponita0 / PoniLCU

A league of legends LCU library
MIT License
21 stars 6 forks source link

[.NET6] Webscoekts issue #16

Open Ponita0 opened 2 years ago

Ponita0 commented 2 years ago

When using on .NET6 It does stack overflow exception when league client opens or closes when the app is opened.

Possible fixes

mikaeldui commented 2 years ago

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.

Ponita0 commented 2 years ago

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