discord-net/Discord.Net

[Bug]: `Channel.SendXXXAsync` methods throw exception on Mono

Withaust opened this issue · 1 comments

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

When I am trying to send files it throws an exception for some reason.

Version

3.12.0

Working Version

No response

Logs

18:38:36 Discord     Discord.Net v3.12.0 (API v10)
18:38:36 Gateway     Connecting
18:38:37 Gateway     You're using the GuildPresences intent without listening to the PresenceUpdate event, consider removing the intent from your config.
18:38:37 Gateway     You're using the GuildScheduledEvents gateway intent without listening to any events related to that intent, consider removing the intent from your config.
18:38:37 Gateway     You're using the GuildInvites gateway intent without listening to any events related to that intent, consider removing the intent from your config.
18:38:37 Gateway     Connected
18:38:38 Gateway     Ready
18:38:40 Gateway     A MessageReceived handler has thrown an unhandled exception.:
System.ArgumentException: boundary
  at System.Net.Http.MultipartContent..ctor (System.String subtype, System.String boundary) [0x00053] in <b7eda14773ab40b499243c2edb346231>:0
  at System.Net.Http.MultipartFormDataContent..ctor (System.String boundary) [0x00000] in <b7eda14773ab40b499243c2edb346231>:0
  at Discord.Net.Rest.DefaultRestClient.SendAsync (System.String method, System.String endpoint, System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] multipartParams, System.Threading.CancellationToken cancelToken, System.Boolean headerOnly, System.String reason, System.Collections.Generic.IEnumerable`1[T] requestHeaders) [0x000d0] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.Net.Queue.MultipartRestRequest.SendAsync () [0x000a5] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.Net.Queue.RequestBucket.SendAsync (Discord.Net.Queue.RestRequest request) [0x00240] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.Net.Queue.RequestQueue.SendAsync (Discord.Net.Queue.RestRequest request) [0x00103] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.API.DiscordRestApiClient.SendInternalAsync (System.String method, System.String endpoint, Discord.Net.Queue.RestRequest request) [0x00152] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.API.DiscordRestApiClient.SendMultipartAsync[TResponse] (System.String method, System.String endpoint, System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] multipartArgs, Discord.Net.BucketId bucketId, Discord.Net.Queue.ClientBucketType clientBucket, Discord.RequestOptions options) [0x000c7] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.API.DiscordRestApiClient.UploadFileAsync (System.UInt64 channelId, Discord.API.Rest.UploadFileParams args, Discord.RequestOptions options) [0x00206] in <172b07ab23d642bfaa27b60735f01394>:0
  at Discord.Rest.ChannelHelper.SendFilesAsync (Discord.IMessageChannel channel, Discord.Rest.BaseDiscordClient client, System.Collections.Generic.IEnumerable`1[T] attachments, System.String text, System.Boolean isTTS, Discord.Embed embed, Discord.AllowedMentions allowedMentions, Discord.MessageReference messageReference, Discord.MessageComponent components, Discord.ISticker[] stickers, Discord.RequestOptions options, Discord.Embed[] embeds, Discord.MessageFlags flags) [0x00545] in <172b07ab23d642bfaa27b60735f01394>:0
  at Main.MessageReceivedAsync (Discord.WebSocket.SocketMessage message) [0x000a7] in S:\Bratulets\Scripts\Main.cs:30
  at Discord.EventExtensions.InvokeAsync[T] (Discord.AsyncEvent`1[T] eventHandler, T arg) [0x0009a] in <dfdca9c82a26448fb7a27a7583f8b0cc>:0
  at Discord.WebSocket.DiscordSocketClient.TimeoutWrap (System.String name, System.Func`1[TResult] action) [0x001c8] in <57358e654f8a4d81a2e89fd6e7562ebc>:0

Sample

private async Task MessageReceivedAsync(SocketMessage message)
{
    await message.Channel.SendFileAsync("Images/test.png");
}

Packages

None

Environment

  • OS: Windows 11 23H2 25915
  • Architecture: x64
  • SDK: Mono 6.12.0
Anu6is commented

Mono is not officially supported.