Ooui
Ooui copied to clipboard
"Xamarin.Forms with Web Assembly" example. Failed to process received message: Newtonsoft.Json.JsonSerializationException
Send {"m":"event","id":"⦙5","k":"click","v":{"offsetX":531,"offsetY":14}} ooui.js:12:24
Failed to process received message: Newtonsoft.Json.JsonSerializationException: Error getting value from 'MessageType' on 'Ooui.Message'. ---> System.NullReferenceException: Object reference not set to an instance of an object. mono.js:1:34956
at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) <0x24c5c68 + 0x00294> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) <0x24c5568 + 0x00048> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at System.Linq.Expressions.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) <0x24c53d8 + 0x0000e> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure) <0x24bd9b0 + 0x00028> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate () <0x24bd840 + 0x0000a> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at System.Linq.Expressions.Expression1[TDelegate].Compile (System.Boolean preferInterpretation) <0x2615348 + 0x0001c> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956 at System.Linq.Expressions.Expression
1[TDelegate].Compile () <0x2615310 + 0x0000a> in <925a8f26f6cb48aba56b19a0300004fc>:0 mono.js:1:34956
at Newtonsoft.Json.Utilities.ExpressionReflectionDelegateFactory.CreateGet[T] (System.Reflection.FieldInfo fieldInfo) <0x260b138 + 0x000ba> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateGet[T] (System.Reflection.MemberInfo memberInfo) <0x260ad48 + 0x00050> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue (System.Object target) <0x260ab40 + 0x0002a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
--- End of inner exception stack trace --- mono.js:1:34956
at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue (System.Object target) <0x260ab40 + 0x0008a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue (Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Object target) <0x2609ca0 + 0x000a2> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) <0x25df848 + 0x003fa> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) <0x25ca080 + 0x0029e> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) <0x25c8fa0 + 0x000ce> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) <0x238a7c0 + 0x001aa> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x237dd28 + 0x000b0> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x237d648 + 0x0001c> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) <0x235f888 + 0x0006c> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) <0x235f068 + 0x00020> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) <0x235efa8 + 0x0000a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0 mono.js:1:34956
at Ooui.WebAssemblySession.ReceiveMessageJson (System.String json) <0x235ec00 + 0x0000e> in
Getting the same error here when trying to test Ooui.Wasm + Forms published as a static website. The static page is loaded and initial Xamarin.Forms layout is rendered but button click doesn't work with the following error printed to the console:
https://mobcatsamplesstorage.blob.core.windows.net/oouisamples/index.html
Failed to process received message: Newtonsoft.Json.JsonSerializationException: Error getting value from 'MessageType' on 'Ooui.Message'. ---> System.NullReferenceException: Object reference not set to an instance of an object.
mono.js:1 at System.Linq.Expressions.Interpreter.LightLambda.MakeRunDelegateCtor (System.Type delegateType) <0x255c030 + 0x00294> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Interpreter.LightLambda.GetRunDelegateCtor (System.Type delegateType) <0x255b930 + 0x00048> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Interpreter.LightLambda.MakeDelegate (System.Type delegateType) <0x2553740 + 0x0000e> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate (System.Runtime.CompilerServices.IStrongBox[] closure) <0x2552e80 + 0x00028> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Interpreter.LightDelegateCreator.CreateDelegate () <0x2552d10 + 0x0000a> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Expression`1[TDelegate].Compile (System.Boolean preferInterpretation) <0x26ae6d0 + 0x0001c> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at System.Linq.Expressions.Expression`1[TDelegate].Compile () <0x26ae698 + 0x0000a> in <f6e39cacb6aa420b89273d00af75095c>:0
mono.js:1 at Newtonsoft.Json.Utilities.ExpressionReflectionDelegateFactory.CreateGet[T] (System.Reflection.FieldInfo fieldInfo) <0x26a2a30 + 0x000ba> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateGet[T] (System.Reflection.MemberInfo memberInfo) <0x26a2640 + 0x00050> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue (System.Object target) <0x26a2438 + 0x0002a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 --- End of inner exception stack trace ---
mono.js:1 at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue (System.Object target) <0x26a2438 + 0x0008a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue (Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Object target) <0x26a1598 + 0x000a2> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) <0x2677bb0 + 0x003fa> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) <0x266dd28 + 0x0029e> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) <0x2662ed8 + 0x000ce> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) <0x2426368 + 0x001aa> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x24180c0 + 0x000b0> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) <0x24179e0 + 0x0001c> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) <0x23fd600 + 0x0006c> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) <0x23fcde0 + 0x00020> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) <0x23fcd20 + 0x0000a> in <9b6398b0b3ae4afdb586fd62eda2ead4>:0
mono.js:1 at Ooui.WebAssemblySession.ReceiveMessageJson (System.String json) <0x23fc978 + 0x0000e> in <9bb9d93261e543f6adb8cd3fa7c65a76>:0
A few additional test to isolate the issue:
- Running the same code using a local server (
phyton server.py
) reproduces the same issue, so this is not related to the publishing - Running the same code without Ooui.Wasm (
dotnet run mycoolapp.dll
) works fine and the button click handler is properly executed (on the server side)
By the confirmation from the author, this is a known issue and the Ooui SDK to be adopted for .NET 6