Lachee / discord-rpc-csharp

C# custom implementation for Discord Rich Presence. Not deprecated and still available!
MIT License
560 stars 94 forks source link

[BUG] Presence Update methods and SkipIdenticalPresence #102

Closed LeagueRaINi closed 3 years ago

LeagueRaINi commented 3 years ago

Describe the bug When SkipIdenticalPresence is false the update presence methods like UpdateLargeAsset(), UpdateState()... will always fail to send because they set CurrentPresence, it then fails to pass the identical check in SetPresence https://github.com/Lachee/discord-rpc-csharp/blob/6f94c2be7b1e3c69ad12b7bf2ab97955c2accf98/DiscordRPC/DiscordRpcClient.cs#L480-L481

To Reproduce Steps to reproduce the behavior:

  1. Set SkipIdenticalPresence to false
  2. Use any of the presense update methods like UpdateLargeAsset(), UpdateState()...

Expected behavior Updates CurrentPresence and queues the presence update without having to set SkipIdenticalPresence to false

Other I also just noticed that at the end of SetPresence u do this https://github.com/Lachee/discord-rpc-csharp/blob/6f94c2be7b1e3c69ad12b7bf2ab97955c2accf98/DiscordRPC/DiscordRpcClient.cs#L486 which unnecessary clones if SetPresence got called with CurrentPresence as argument as it is the case with the update presence methods https://github.com/Lachee/discord-rpc-csharp/blob/6f94c2be7b1e3c69ad12b7bf2ab97955c2accf98/DiscordRPC/DiscordRpcClient.cs#L495-L506

LeagueRaINi commented 3 years ago

Also, is there any special reason that SetPresence gets inconsistently called inside/outside the thread safety locks? Saw that while trying to think of a potential fix for the issue mentioned above https://github.com/Lachee/discord-rpc-csharp/blob/6f94c2be7b1e3c69ad12b7bf2ab97955c2accf98/DiscordRPC/DiscordRpcClient.cs#L508-L544

Lachee commented 3 years ago

This is currently being worked on

Lachee commented 3 years ago

This should be fixed now.