DiscordApiClient.PrepareMessage() throws NRE
Created by: ivan-ristovic
Make sure you familiarize yourself with our contributing guidelines.
Summary
NullReferenceException
occurs when trying to upload a file with size greater than the allowed maximum.
Details
Stack trace:
at DSharpPlus.Net.DiscordApiClient.PrepareMessage(JToken msg_raw)
at DSharpPlus.Net.DiscordApiClient.UploadFileAsync(UInt64 channel_id, Stream file_data, String file_name, String content, Nullable`1 tts, DiscordEmbed embed)
The lib version is the latest nightly and the bot is running on .NET Core 2.1.
Steps to reproduce
- Try to upload a large file (I tried >50MB one) via CommandContext.RespondWithFileAsync()
- NRE
Notes
I have searched the code and I haven't found any checks on the Stream passed to DiscordApiClient.UploadFileAsync method. So I assume that the request returned contains null
response string and that gets passed to DiscordApiClient.PrepareMessage() method, which then throws.