discord-net / Discord.Net

An unofficial .Net wrapper for the Discord API (https://discord.com/)
https://discordnet.dev
MIT License
3.32k stars 737 forks source link

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

Closed Kromzem closed 9 months ago

Kromzem commented 9 months ago

Check The Docs

Verify Issue Source

Check your 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)

Misha-133 commented 9 months ago

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

Kromzem commented 9 months ago

@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

Misha-133 commented 9 months ago

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>
Kromzem commented 9 months ago

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