question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StringEnumException with Json.Net

See original GitHub issue

Description

I am getting an exception when trying to use the MoveAsync and ClickAsync of a page.

Complete minimal example reproducing the issue

var mouse = Mouse.GetState();

if (mouse.LeftButton == ButtonState.Pressed) {
    page.Mouse.ClickAsync(mouse.X, mouse.Y).Wait();
    Console.WriteLine("Mouse clicked");
} else {
    page.Mouse.MoveAsync(mouse.X, mouse.Y).Wait();
}

Expected behavior:

The web page updating depending where the mouse is allowing me to render onto a game

Actual behavior:

A large Exception that I don’t know which side is causing it. Json.Net or puppeteer-sharp

Versions

  • Which version of PuppeteerSharp are you using? v1.18
  • Which .NET runtime and version are you targeting? .Net 4.7.2

Additional Information

The Exception: Unhandled exception in Staxel.Client.Program.Main: System.AggregateException: One or more errors occurred. (Error creating ‘Newtonsoft.Json.Converters.StringEnumConverter’.) —> PuppeteerSharp.MessageException: Error creating ‘Newtonsoft.Json.Converters.StringEnumConverter’. —> Newtonsoft.Json.JsonException: Error creating ‘Newtonsoft.Json.Converters.StringEnumConverter’. —> Newtonsoft.Json.JsonException: No matching parameterized constructor found for ‘Newtonsoft.Json.Converters.StringEnumConverter’. at Newtonsoft.Json.Serialization.JsonTypeReflector+<>c__DisplayClass18_0.<GetJsonConverterCreator>b__0 (System.Object[] parameters) [0x0007b] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 — End of inner exception stack trace — at Newtonsoft.Json.Serialization.JsonTypeReflector+<>c__DisplayClass18_0.<GetJsonConverterCreator>b__0 (System.Object[] parameters) [0x000d0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonConverter (System.Object attributeProvider) [0x00025] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContractConverter (System.Type objectType) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00040] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.CreatePrimitiveContract (System.Type objectType) [0x00007] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00008] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x0003e] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) [0x00053] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00095] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x0023c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) [0x0002a] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at PuppeteerSharp.Connection.RawSendASync (System.Int32 id, System.String method, System.Object args, System.String sessionId) [0x00029] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/Connection.cs:96 at PuppeteerSharp.CDPSession.SendAsync (System.String method, System.Object args, System.Boolean waitForCallback) [0x000ed] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/CDPSession.cs:146 — End of inner exception stack trace — at PuppeteerSharp.CDPSession.SendAsync (System.String method, System.Object args, System.Boolean waitForCallback) [0x00211] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/CDPSession.cs:156 at PuppeteerSharp.Input.Mouse.MoveAsync (System.Decimal x, System.Decimal y, PuppeteerSharp.Input.MoveOptions options) [0x00174] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/Input/Mouse.cs:48 — End of inner exception stack trace — at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in /build/mono/src/mono/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2027 at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in /build/mono/src/mono/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2759 at System.Threading.Tasks.Task.Wait () [0x00000] in /build/mono/src/mono/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2625 at Staxel.Mono.Patches.StaxelGameOverride+UpdateOverride.Postfix (Staxel.Client.StaxelGame __instance, Microsoft.Xna.Framework.GameTime gameTime) [0x00077] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Staxel.Mono/Patches/StaxelGameOverride.cs:38 at (wrapper dynamic-method) Staxel.Client.StaxelGame.Update_Patch1(Staxel.Client.StaxelGame,Microsoft.Xna.Framework.GameTime) at Microsoft.Xna.Framework.Game.Tick () [0x001f4] in <8dc9bf75e6cc40b6ad361fc8d2ed7b5f>:0 at Microsoft.Xna.Framework.SDL2_FNAPlatform.RunLoop (Microsoft.Xna.Framework.Game game) [0x005f8] in <8dc9bf75e6cc40b6ad361fc8d2ed7b5f>:0 at Microsoft.Xna.Framework.Game.Run () [0x0002c] in <8dc9bf75e6cc40b6ad361fc8d2ed7b5f>:0 at Staxel.Client.Program.RunGame (System.String[] args, System.Boolean console) [0x0029b] in <f1ec031d2d64433391f8c00419f52505>:0 —> (Inner Exception #0) PuppeteerSharp.MessageException: Error creating ‘Newtonsoft.Json.Converters.StringEnumConverter’. —> Newtonsoft.Json.JsonException: Error creating ‘Newtonsoft.Json.Converters.StringEnumConverter’. —> Newtonsoft.Json.JsonException: No matching parameterized constructor found for ‘Newtonsoft.Json.Converters.StringEnumConverter’. at Newtonsoft.Json.Serialization.JsonTypeReflector+<>c__DisplayClass18_0.<GetJsonConverterCreator>b__0 (System.Object[] parameters) [0x0007b] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 — End of inner exception stack trace — at Newtonsoft.Json.Serialization.JsonTypeReflector+<>c__DisplayClass18_0.<GetJsonConverterCreator>b__0 (System.Object[] parameters) [0x000d0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonConverter (System.Object attributeProvider) [0x00025] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContractConverter (System.Type objectType) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract (Newtonsoft.Json.Serialization.JsonContract contract) [0x00040] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.CreatePrimitiveContract (System.Type objectType) [0x00007] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract (System.Type objectType) [0x00008] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract (System.Type type) [0x0003e] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContainerContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.Serialization.JsonContract& memberContract, System.Object& memberValue) [0x00053] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00095] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x0023c] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) [0x0002a] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <d44dd010ea0648f5a3cfadd2ab95bdb8>:0 at PuppeteerSharp.Connection.RawSendASync (System.Int32 id, System.String method, System.Object args, System.String sessionId) [0x00029] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/Connection.cs:96 at PuppeteerSharp.CDPSession.SendAsync (System.String method, System.Object args, System.Boolean waitForCallback) [0x000ed] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/CDPSession.cs:146 — End of inner exception stack trace — at PuppeteerSharp.CDPSession.SendAsync (System.String method, System.Object args, System.Boolean waitForCallback) [0x00211] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/CDPSession.cs:156 at PuppeteerSharp.Input.Mouse.MoveAsync (System.Decimal x, System.Decimal y, PuppeteerSharp.Input.MoveOptions options) [0x00174] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Dependencies/puppeteer-sharp/lib/PuppeteerSharp/Input/Mouse.cs:48 <— from at System.Environment.get_StackTrace () [0x00000] in /build/mono/src/mono/mcs/class/corlib/System/Environment.cs:316 at Plukit.Base.Logger.LogCriticalException (System.String message, System.Exception e) [0x00000] in <c24ce2c511564cb296b8e9df19f601b9>:0 at Staxel.Client.Program.RunGame (System.String[] args, System.Boolean console) [0x00000] in <f1ec031d2d64433391f8c00419f52505>:0 at Staxel.Client.Program.RunGame (System.String[] args) [0x00000] in <f1ec031d2d64433391f8c00419f52505>:0 at Staxel.Client.DotNet.Program.Main (System.String[] args) [0x00000] in <810cef7f6faa436bb5fbfdf386264e84>:0 at Staxel.Mono.Program.Main (System.String[] args) [0x00027] in /home/nimbusfox/WIP/Staxel-UI-Replacement/Staxel.Mono/Program.cs:15

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
NimbusFoxcommented, Jul 16, 2019

I found my problem. The game I am working with is using a custom version of Json.NET and was missing a function. I have fixed it on my end. Thanks for the support

0reactions
NimbusFoxcommented, Jul 16, 2019

I think I found my problem. Gonna try something and it may tell me what went wrong

Read more comments on GitHub >

github_iconTop Results From Across the Web

StringEnumException with Json.Net · Issue #1217
Description I am getting an exception when trying to use the MoveAsync and ClickAsync of a page. Complete minimal example reproducing the ...
Read more >
Serializing and Deserializing JSON
The quickest method of converting between JSON text and a .NET object is using the JsonSerializer. The JsonSerializer converts .NET objects into their...
Read more >
How to serialize and deserialize JSON using C# - .NET
A common way to deserialize JSON is to first create a class with properties and fields that represent one or more of the...
Read more >
Serializing and Deserializing Enumerations with Json.NET
Json.NET comes with the StringEnumConverter to convert between an enum and the JSON string representation. The property of the ErrorCode enum ...
Read more >
c# - Deserialize json with JSON.NET, but keep original ...
So, I have a corresponding class structure for deserialization. On a transaction level the class have only well-known fields. But on each ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found