Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for native AOT compilation #1637

Open
migueloliveiradev opened this issue Oct 2, 2023 · 2 comments
Open

No support for native AOT compilation #1637

migueloliveiradev opened this issue Oct 2, 2023 · 2 comments
Milestone

Comments

@migueloliveiradev
Copy link
Contributor

Describe the bug

When trying to do a Native AOT compilation using .NET 7 or .NET 8 I receive an error

bot-fy  | [2023-10-02 18:50:02 -03:00] [102 /ConnectionFa] [Error] Connection attempt failed, retrying in 7s
bot-fy  | Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type DSharpPlus.Net.GatewayInfo. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'url', line 1, position 7.
bot-fy  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader, JsonObjectContract, JsonProperty, JsonProperty, String, Boolean&) + 0x17b
bot-fy  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader, Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object) + 0x2be
bot-fy  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader, Type, JsonContract, JsonProperty, JsonContainerContract, JsonProperty, Object) + 0x9e
bot-fy  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader, Type, Boolean) + 0x24a
bot-fy  |    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader, Type) + 0x108
bot-fy  |    at Newtonsoft.Json.Linq.JToken.ToObject(Type, JsonSerializer) + 0xaf
bot-fy  |    at Newtonsoft.Json.Linq.JToken.ToObject[T](JsonSerializer) + 0x2d
bot-fy  |    at DSharpPlus.Net.DiscordApiClient.<GetGatewayInfoAsync>d__184.MoveNext() + 0x3b6
bot-fy  | --- End of stack trace from previous location ---
bot-fy  |    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xc2
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x44
bot-fy  |    at DSharpPlus.BaseDiscordClient.<GetGatewayInfoAsync>d__36.MoveNext() + 0x430
bot-fy  | --- End of stack trace from previous location ---
bot-fy  |    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xc2
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x44
bot-fy  |    at DSharpPlus.DiscordClient.<InternalUpdateGatewayAsync>d__505.MoveNext() + 0xbc
bot-fy  | --- End of stack trace from previous location ---
bot-fy  |    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xc2
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x44
bot-fy  |    at DSharpPlus.DiscordClient.<InternalConnectAsync>d__493.MoveNext() + 0x71b
bot-fy  | --- End of stack trace from previous location ---
bot-fy  |    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
bot-fy  |    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xc2
bot-fy  |    at DSharpPlus.DiscordClient.<ConnectAsync>d__46.MoveNext() + 0x57b

While doing some investigation, I noticed an incompatibility of the Newtonsoft.Json library, which mentioned by the library owner, such support is unlikely

I decided to leave this issue because maybe in v6 System.Text.Json could be used

@akiraveliara
Copy link
Contributor

STJ is being used, but NAOT is a lot of work regardless and will probably not have complete support even through v6 - it's possible, but i recommend not getting your hopes up.

@akiraveliara akiraveliara added v6.x and removed bug labels Oct 2, 2023
@migueloliveiradev
Copy link
Contributor Author

Ok

@akiraveliara akiraveliara added this to the Backlog milestone Oct 5, 2023
@akiraveliara akiraveliara removed the v6.x label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants