Skip to content

CommandsExtension.AddChecks(Assembly assembly) throws when one class implements multiple IContextCheck<T> #2262

Description

@13xforever

Summary

The issue is that inside the method it calls t.GetInterface() instead of t.GetInterfaces(), like it does in `AddCheck(Type t)

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 9.0

Operating System

Windows 11 24H2

Reproduction Steps

  1. have one class implementing at least two IContextCheck<T>
  2. try to register all checks using extension.AddChecks(Assembly.GetExecutingAssembly()) or similar

Trace Logs


Exceptions or other error messages

System.Reflection.AmbiguousMatchException: Ambiguous match found for ' DSharpPlus.Commands.ContextChecks.IContextCheck`1[CompatBot.Commands.Attributes.LimitedToHelpChannelAttribute]'.
   at System.RuntimeType.GetInterface(String fullname, Boolean ignoreCase)
   at DSharpPlus.Commands.CommandsExtension.AddChecks(Assembly assembly)
   at CompatBot.Program.<>c.<Main>b__4_1(IServiceProvider services, CommandsExtension extension) in E:\Work\git\discord-bot\CompatBot\Program.cs:line 156

Anything else you'd like to share

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    commandsFor issues related to DSharpPlus.Commands

    Type

    Fields

    Effort

    None yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions