DSharpPlus
DSharpPlus copied to clipboard
SendPaginatedMessageAsync causes stack overflow
Summary
Using the InteractivityExtension.SendPaginatedMessageAsync(DiscordChannel, DiscordUser, IEnumerable<Interactivity.Page>, TimeSpan, PaginationBehaviour, ButtonPaginationBehavior) method causes stack overflow.
Details
I have tested the text I need to paginate on all interactivity pagination methods and it worked fine, except for this method.
This is the stack trace:
Stack overflow.
Repeat 10756 times:
--------------------------------
at DSharpPlus.Interactivity.InteractivityExtension.SendPaginatedMessageAsync(DSharpPlus.Entities.DiscordChannel, DSharpPlus.Entities.DiscordUser, System.Collections.Generic.IEnumerable`1<DSharpPlus.Interactivity.Page>, System.Nullable`1<System.TimeSpan>, System.Nullable`1<DSharpPlus.Interactivity.Enums.PaginationBehaviour>, System.Nullable`1<DSharpPlus.Interactivity.Enums.ButtonPaginationBehavior>)
--------------------------------
at DSharpPlus.Test.PaginationTest+<TestPaginateAsync>d__2.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at DSharpPlus.Test.PaginationTest.TestPaginateAsync(DSharpPlus.CommandsNext.CommandContext)
at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean)
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at System.Delegate.DynamicInvokeImpl(System.Object[])
at System.Delegate.DynamicInvoke(System.Object[])
at DSharpPlus.CommandsNext.Command+<ExecuteAsync>d__39.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[DSharpPlus.CommandsNext.CommandResult, DSharpPlus.CommandsNext, Version=4.3.0.0, Culture=neutral, PublicKeyToken=null]].Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at DSharpPlus.CommandsNext.Command.ExecuteAsync(DSharpPlus.CommandsNext.CommandContext)
at DSharpPlus.CommandsNext.CommandsNextExtension+<ExecuteCommandAsync>d__26.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at DSharpPlus.CommandsNext.CommandsNextExtension.ExecuteCommandAsync(DSharpPlus.CommandsNext.CommandContext)
at DSharpPlus.CommandsNext.Executors.ParallelQueuedCommandExecutor+<ExecuteAsync>d__13.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Threading.ThreadPool+<>c.<.cctor>b__87_0(System.Object)
at System.Threading.Channels.AsyncOperation`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].SetCompletionAndInvokeContinuation()
at System.Threading.Channels.AsyncOperation`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Threading.IThreadPoolWorkItem.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Steps to reproduce
- Initialize a string, preferably with more than 41 words,
- Use the
InteractivityExtension.GeneratePagesInContentmethod on the string to generate the pagination pages, - Use the
InteractivityExtension.SendPaginatedMessageAsync(DiscordChannel, DiscordUser, IEnumerable<Interactivity.Page>, TimeSpan, PaginationBehaviour, ButtonPaginationBehavior)method. The stack overflow should occur right away.
Finally someone made an issue for this SendPaginatedMessageAsync seems to only cause an SO when supplied with a timeout override param