Closed kevinvella closed 6 years ago
for iOS, required precode generation. see: https://github.com/neuecc/Utf8Json#pre-code-generationunityxamarin-supports
@neuecc Ok. One question. How should i generate the resolvers for PureSocketCluster?
related to https://github.com/Coinigy/PureSocketCluster/issues/8 ?
It seems to serialize Dictionary<string, object>
.
https://github.com/Coinigy/PureSocketCluster/blob/master/src/PureSocketCluster/PureSocketClusterSocket.cs
I think configure and use include PrimitiveObjectFormatter
, maybe works.
Yes i created an issue on their repo.
I am trying to get the universal code generator to work / figuring it out.
For the PrimitiveObjectFormatter, you saying something like this?
Utf8Json.Resolvers.CompositeResolver.RegisterAndSetAsDefault(
// use generated resolver first, and combine many other generated/custom resolvers
Utf8Json.Resolvers.DynamicCompositeResolver.Create(
new Utf8Json.IJsonFormatter[] { PrimitiveObjectFormatter.Default }
,new Utf8Json.IJsonFormatterResolver[] { Utf8Json.Resolvers.StandardResolver.Default }
)
);
If i use
Utf8Json.Resolvers.CompositeResolver.RegisterAndSetAsDefault(new Utf8Json.IJsonFormatter[] { PrimitiveObjectFormatter.Default });
I get this
You can set like following.
Utf8Json.Resolvers.CompositeResolver.RegisterAndSetAsDefault(
new [] { PrimitiveObjectFormatter.Default },
new [] { Utf8Json.Resolvers.StandardResolver.Default }
);
Using the above i get the same platform not support exception.
The type initializer for 'Utf8Json.Resolvers.Internal.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateOriginal' threw an exception.
Will continue trying to work out the universal code generator
How about this?
Utf8Json.Resolvers.CompositeResolver.RegisterAndSetAsDefault(
new [] { PrimitiveObjectFormatter.Default },
new Utf8Json.IJsonFormatterResolver[]
{
// + code generator resolver(serialize custom type)
Utf8Json.Resolvers.BuiltinResolver.Instance,
// EnumResolver.Default,(can't serialize enum...)
Utf8Json.Resolvers.DynamicGenericResolver.Instance,
Utf8Json.Resolvers.AttributeFormatterResolver.Instance
}
);
beat me to it
I will externalize the deserializer interface to allow modifications
Holy cow. This works! :D :D
Receiving data from the websocket. Will try to send data shortly.
Thanks very much for this!!! I'm in your debt hahaha
Hi,
I was trying the PureSocketCluster library. Internally it uses Utf8Json. When i run it on iOS it gives me an Operation is not supported on this platform.
Running it on Xamarin.Android it works very well.
Versions: Utf8Json - v1.3.7 Xamarin Forms - v2.5.1.444934
Hope this can help Attaching some screenshots of the stack trace