Open Panthr75 opened 11 months ago
Maybe I could make a source analyzer/generator for this? We could also enforce some style rules as well, so it's a win/win.
Maybe I could make a source analyzer/generator for this? We could also enforce some style rules as well, so it's a win/win.
cc @quinchs
@Panthr75 there's no need to override these interface members. In your example
_ = await interfaceClient.GetSKUsAsync();
will actually call the method implementation from DiscordRestClient
, not BaseDiscordClient
Same applies to other methods you've mentioned.
You an easily verify it by placing breakpoints in DiscordRestClient
.
Removing the bug
label, but will leave the issue open
A source analyzer for ensuring that all IDiscordClient
methods are actually implemented in DiscordRest/SocketClient
would be nice IMO.
Check The Docs
Verify Issue Source
Check your intents
Description
DiscordRestClient
andBaseSocketClient
were modified to include the interface implementation override for memberTask<IEntitlement> IDiscordClient.CreateTestEntitlementAsync(ulong, ulong, SubscriptionOwnerType, RequestOptions?)
, but not for:Task IDiscordClient.DeleteTestEntitlementAsync(ulong, RequestOptions?)
IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> IDiscordClient.GetEntitlementsAsync(int?, ulong?, ulong?, bool, ulong?, ulong?, ulong[]?, RequestOptions?)
Task<IReadOnlyCollection<SKU>> IDiscordClient.GetSKUsAsync(RequestOptions?)
This means that when using an object of type
IDiscordClient
and calling one of those non-overriden members, you will get unexpected behaviour, as it will use the implementation insideBaseDiscordClient
which returnsnull
pretty much.This isn't the first time this has happened: https://github.com/discord-net/Discord.Net/commit/8baf913c9d4e5504384062c8d74fe8f3f70efcd0
Maybe some automated tooling needs to be put into place so that
BaseSocketClient
andDiscordRestClient
properly override the defaultBaseDiscordClient
implementation, or a reconsideration of how these classes are structured may need to take place.Version
3.13.0
Working Version
3.12.0
Logs
Sample
Packages
N/A
Environment
N/A