discord-net/Discord.Net

[Bug]: Serializer Error with many Shards and GUILDS intent

Kromzem opened this issue · 4 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

Hey :)

I have the issue that my bot with ~23 shards refuses to start ...

Everytime a shard tries to connect I get the following error:

[20:20:07 DBG] [Warning][Shard #4] Serializer Error System.ArgumentNullException: Value cannot be null. (Parameter 's') at Discord.Net.Converters.OptionalConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)

What could be the cause of this error?
If I remove the "GUILDS"-Intent the error disappears.

Version

3.13.0

Working Version

No response

Logs

[20:20:07 DBG] [Warning][Shard #4] Serializer Error  
System.ArgumentNullException: Value cannot be null. (Parameter 's')  
at Discord.Net.Converters.OptionalConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)  
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)

Sample

No response

Packages

Lavalink4NET.Discord.NET - 4.0.6

Environment

OS: Debian 5.10.197-1 (2023-09-29) x86_64 GNU/Linux
SDK: .NET 8 (Problem existed in .NET 6 too)

That's a known issue
It has been fixed in #2813
You can use myget nightly feed until we push a patch release

@Misha-133 How can I get access to the nightly feed? Everytime when I click on the link in the guides I get to the landing page of myget.com

You need to add it as a nuget source

You can add it system wide:

dotnet nuget add source https://www.myget.org/F/discord-net/api/v3/index.json -n Discord.Net-Myget

or you can specify it in the Nuget.Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    ...
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="DNet MyGet" value="https://www.myget.org/F/discord-net/api/v3/index.json" />
  </packageSources>
</configuration>

Thank you very much I got it working with your help :)