FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Unable to use `IReadOnlyList<string>` for Variadic Arguments like specified in docs · Issue #2201 · DSharpPlus/DSharpPlus · GitHub

Unable to use IReadOnlyList<string> for Variadic Arguments like specified in docs #2201

Description

Summary

Currently one has to use a string array to initialize variadic arguments in DSP.C. The docs article however specifies it should be (only) possible with IReadOnlyList<string>.

Reference: https://discord.com/channels/379378609942560770/1094835363475886163/1312537478095310909

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 23H2 22635.4515

Reproduction Steps

  1. Create a new command and specify VariadicArgument in the attribute
  2. Initialize it with an IReadOnlyList<string>
  3. See the error message during initialization

Trace Logs

Exceptions or other error messages

DSharpPlus.IClientErrorHandler[0] Event handler exception for event DSharpPlus.EventArgs.ClientStartedEventArgs thrown from System.Threading.Tasks.Task lambda_method13(System.Runtime.CompilerServices.Closure, DSharpPlus.DiscordClient, DSharpPlus.EventArgs.ClientStartedEventArgs, System.IServiceProvider) (defined in (null)).
System.InvalidOperationException: No converter found for parameter type 'IReadOnlyList`1'
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ToApplicationParameterAsync(Command command, CommandParameter parameter, Int32 i)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.PopulateVariadicParametersAsync(Command command, List`1 options)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ToApplicationParameterAsync(Command command, Int32 depth)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ToApplicationParameterAsync(Command command)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ToApplicationCommandAsync(Command command)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.RegisterSlashCommandsAsync(CommandsExtension extension)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ConfigureAsync(CommandsExtension extension)
   at DSharpPlus.Commands.CommandsExtension.RefreshAsync()
   at DSharpPlus.Commands.RefreshEventHandler.HandleEventAsync(DiscordClient sender, ClientStartedEventArgs eventArgs)
   at DSharpPlus.Clients.DefaultEventDispatcher.<>c__DisplayClass6_0`1.<<DispatchAsync>b__0>d.MoveNext()

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


      Back | FazBrowse Home | New Git URL