question

Stesvis-5434 avatar image
6 Votes"
Stesvis-5434 asked SikandarAmla-0331 edited

JsonSerializer throws exception in xamarin.ios

While in android everything works fine (as most times), in iOS this line
var payload = System.Text.Json.JsonSerializer.Serialize(postData);
throws an exception:

System.TypeInitializationException: The type initializer for 'System.Text.Json.JsonSerializer' threw an exception. ---> System.MissingMethodException: Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`1<byte>)
at System.Text.Json.JsonEncodedText.EncodeHelper (System.ReadOnlySpan`1[T] utf8Value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00000] in <7e3a59f5e4004edbb4b17c580799cc52>:0
at System.Text.Json.JsonEncodedText.TranscodeAndEncode (System.ReadOnlySpan`1[T] value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00033] in <7e3a59f5e4004edbb4b17c580799cc52>:0
at System.Text.Json.JsonEncodedText.Encode (System.ReadOnlySpan`1[T] value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00014] in <7e3a59f5e4004edbb4b17c580799cc52>:0
at System.Text.Json.JsonEncodedText.Encode (System.String value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00014] in <7e3a59f5e4004edbb4b17c580799cc52>:0
at System.Text.Json.JsonSerializer..cctor () [0x00042] in <7e3a59f5e4004edbb4b17c580799cc52>:0

But it works fine with Newtonsoft:

var payload = Newtonsoft.Json.JsonConvert.SerializeObject(postData);

I have the latest packages of everything.

Is it a known issue in iOS?

dotnet-csharpdotnet-xamarin
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Stesvis-5434 ,I did a simple test ,but I couldn't reproduce this problem. Could you please post a basic demo so that we can test on our side?

0 Votes 0 ·

@JessieZhang-2116 please see my longer comment below.
It seems to not like the fact that my class has ReactiveObject as base class. If I remove it, it works.

But I need that base class, so I am not sure what to do...

0 Votes 0 ·

Please post the code of the ReactiveObject

0 Votes 0 ·
MarcoSeraphin-5862 avatar image
7 Votes"
MarcoSeraphin-5862 answered SikandarAmla-0331 edited

To solve the crash when serialising JSON when logging in using System.Text.Json.JsonSerializer instead of NewtonSoft.JSON.

=> Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8

You have to add this to the iOS App project:

<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.4">
<IncludeAssets>none</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Buffers" Version="4.5.1">
<IncludeAssets>none</IncludeAssets>
</PackageReference>
</ItemGroup>

· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

yeah that was the right thing that helped me out ...thnx!

1 Vote 1 ·

Yessss that worked, thank you!

1 Vote 1 ·

Can confirm this solution, you are a hero!

0 Votes 0 ·

This did NOT solve my issue. This code:
var content = new StringContent(
JsonSerializer.Serialize(new { UserName = userName, Password = password }), Encoding.UTF8, "application/json");
throws System.TypeInitializationException on iOS only - on Android it works as expected.


0 Votes 0 ·

Actually - let me restate - the above fix DID solve my problem after I realized I needed to be in .net Standard 2.1

0 Votes 0 ·

THANK YOU! Was going insane here...

0 Votes 0 ·

Helped me as well. I encountered this error with the Refit library, adding these references solved my issue.


0 Votes 0 ·
DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered DuaneArnold-0443 edited

Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`

If the method is not there in the object in the DLL that is being called for, it's not there. Maybe, you need to use a more recent version of the DLL that may have the needed method in an object in the DLL. Or maybe, it's not ever going to be there on the platform you are having issues.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

StephanChristopher-6409 avatar image
3 Votes"
StephanChristopher-6409 answered StephanChristopher-6409 published

We get the same error message when deserialiszing:

var data = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(json);

The error is reproducible with Visual Studio 2019 for Mac version 8.9 but not with version 8.8.6. This affects only iOS. More specifically it is the Xamarin.iOS version 14.14.2.5 that has the bug. If you downgrade manually to the Xamarin.iOS version 14.8.0.3 everything is fine again. Deserializing works on Android with both versions of Visual Studio.

Version 8.9:

=== Visual Studio Community 2019 for Mac ===

Version 8.9 (build 1651)
Installation UUID: 00f5a6c3-e367-494e-ac05-f885ac415e0c
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000122

=== Mono Framework MDK ===

Runtime:
Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit)
Package version: 612000122

=== Roslyn (Language Service) ===

3.9.0-5.21112.8+f3ff04378c972d435826e6181de364b3c0db8d14

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.103/Sdks
SDK Versions:
5.0.103
5.0.102
5.0.101
5.0.100
3.1.406
3.1.405
3.1.404
3.1.403
3.1.402
3.1.401
3.1.302
3.1.301
3.1.300
3.1.200
3.1.102
3.1.101
3.1.100
3.0.101
3.0.100
2.1.701
2.1.700
2.1.505
2.1.504
2.1.503
2.1.302
2.1.301
2.1.4
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
5.0.3
5.0.2
5.0.1
5.0.0
3.1.12
3.1.11
3.1.10
3.1.9
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.1.23
2.1.22
2.1.21
2.1.20
2.1.19
2.1.18
2.1.16
2.1.15
2.1.14
2.1.13
2.1.12
2.1.11
2.1.9
2.1.8
2.1.7
2.1.2
2.1.1
2.0.5

=== .NET Core 3.1 SDK ===

SDK: 3.1.406

=== Xamarin.Profiler ===

Version: 1.6.12.26
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin Designer ===

Version: 16.9.0.316
Hash: bd2705417
Branch: remotes/origin/d16-9
Build date: 2021-02-24 00:16:08 UTC

=== Xamarin.Android ===

Version: 11.2.0.0 (Visual Studio Community)
Commit: xamarin-android/d16-9/f908d16
Android SDK: /Users/marcoseraphin/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 31.0.0
SDK Build Tools Version: 29.0.2

Build Information:
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@1d382be
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.32.2@cfe06e0
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@ad80a42

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/marcoseraphin/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.9.0.22
Hash: a391de2
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:14:56 UTC

=== Android Device Manager ===

Version: 16.9.0.17
Hash: fc2b3db
Branch: remotes/origin/d16-9
Build date: 2021-02-18 03:15:18 UTC

=== Apple Developer Tools ===

Xcode 12.4 (17801)
Build 12D4e

=== Xamarin.Mac ===

Version: 7.8.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:43-0500

=== Xamarin.iOS ===

Version: 14.14.2.5 (Visual Studio Community)
Hash: 3836759d4
Branch: d16-9
Build date: 2021-02-10 17:56:44-0500

=== Build Information ===

Release ID: 809001651
Git revision: c05b1dec4362b5956d47624a437e900ffdc9aa0a
Build date: 2021-02-25 11:27:51-05
Build branch: release-8.9
Xamarin extensions: c05b1dec4362b5956d47624a437e900ffdc9aa0a

=== Operating System ===

Mac OS X 10.15.7
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Thu Oct 29 22:56:45 PDT 2020
root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

LiveXAML 1.3.51
Stack Overflow Search 0.7.1


Version 8.8.6

=== Visual Studio Community 2019 for Mac ===

Version 8.8.6 (build 15)
Installation UUID: 41394e34-af16-4443-a055-e3a05dff10ef
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

Package version: 612000113

=== Mono Framework MDK ===

Runtime:
Mono 6.12.0.113 (2020-02/4fdfb5b1fd5) (64-bit)
Package version: 612000113

=== Roslyn (Language Service) ===

3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa

=== NuGet ===

Version: 5.8.0.6860

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/5.0.102/Sdks
SDK Versions:
5.0.102
3.1.201
2.1.802
MSBuild SDKs: /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
5.0.2
3.1.8
3.1.3
2.1.23
2.1.22
2.1.13

=== .NET Core 3.1 SDK ===

SDK: 3.1.201

=== Xamarin.Profiler ===

Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.3 (17715)
Build 12C33

=== Xamarin.Mac ===

Version: 7.2.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:04-0500

=== Xamarin.iOS ===

Version: 14.8.0.3 (Visual Studio Community)
Hash: c51fabee8
Branch: xcode12.3
Build date: 2020-12-10 21:05:05-0500

=== Xamarin.Android ===

Version: 11.1.0.26 (Visual Studio Community)
Commit: xamarin-android/d16-8/a36ce73
Android SDK: /Users/Shared/Development/Android/sdk
Supported Android versions:
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.4
SDK Build Tools Version: 29.0.2

Build Information:
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/Shared/Development/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.8.0.32
Hash: 01a7774
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:34:58 UTC

=== Android Device Manager ===

Version: 16.8.0.46
Hash: 0a81419
Branch: remotes/origin/d16-8
Build date: 2021-01-14 00:35:22 UTC

=== Xamarin Designer ===

Version: 16.8.0.510
Hash: 44e3f3ce9
Branch: remotes/origin/d16-8
Build date: 2020-12-10 00:06:14 UTC

=== Build Information ===

Release ID: 808060015
Git revision: d34d29b4643a130479d762e4d2b5750e6462fde7
Build date: 2021-01-15 08:35:04-05
Build branch: release-8.8
Xamarin extensions: d34d29b4643a130479d762e4d2b5750e6462fde7

=== Operating System ===

Mac OS X 10.15.7
Darwin 19.6.0 Darwin Kernel Version 19.6.0
Mon Aug 31 22:12:52 PDT 2020
root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

DeepClean 1.2.5





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Stesvis-5434 avatar image
1 Vote"
Stesvis-5434 answered Stesvis-5434 commented

@JessieZhang-2116 ok so for example I have this payload store in an object IEnumerable<SystemSettingDTO>:

[
  {
    "Name": "DefaultSearchRange",
    "Value": 500,
    "Status": "A",
    "Id": 1,
    "CreatedAt": "2021-03-08T22:19:09.2465295"
  },
  {
    "Name": "MaxSearchRange",
    "Value": 500,
    "Status": "A",
    "Id": 2,
    "CreatedAt": "2021-03-08T22:19:09.2466545"
  },
  {
    "Name": "MaxListingsCount",
    "Value": 500,
    "Status": "A",
    "Id": 3,
    "CreatedAt": "2021-03-08T22:19:09.246655"
  },
  {
    "Name": "MaxListingPhotosCount",
    "Value": 3,
    "Status": "A",
    "Id": 4,
    "CreatedAt": "2021-03-08T22:19:09.2466552"
  },
  {
    "Name": "MaxReviewCommentsCount",
    "Value": 1,
    "Status": "A",
    "Id": 5,
    "CreatedAt": "2021-03-08T22:19:09.2466553"
  },
  {
    "Name": "ListingsPerPage",
    "Value": 5,
    "Status": "A",
    "Id": 6,
    "CreatedAt": "2021-03-08T22:19:09.2466554"
  },
  {
    "Name": "ListingsPerPage_Home",
    "Value": 25,
    "Status": "A",
    "Id": 7,
    "CreatedAt": "2021-03-08T22:19:09.2466554"
  },
  {
    "Name": "ReviewsPerPage",
    "Value": 5,
    "Status": "A",
    "Id": 8,
    "CreatedAt": "2021-03-08T22:19:09.2466556"
  },
  {
    "Name": "ChatMessagesPerPage",
    "Value": 15,
    "Status": "A",
    "Id": 9,
    "CreatedAt": "2021-03-08T22:19:09.2466557"
  },
  {
    "Name": "RentalsPerPage",
    "Value": 10,
    "Status": "A",
    "Id": 10,
    "CreatedAt": "2021-03-08T22:19:09.2466558"
  }
]

SystemSettingDTO looks like this:

public class SystemSettingDTO : ReactiveObject
    {
        public int Id { get; set; }

        public DateTime CreatedAt { get; set; }

        public string Name { get; set; }

        public object Value { get; set; }

        public string Status { get; set; }
    }

And in Xamarin Forms (in iOS), I try to serialize it like this:

var json = System.Text.Json.JsonSerializer.Serialize(data);

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please change the

public object Value

to

public string Value


0 Votes 0 ·

I already tried it, same result.

0 Votes 0 ·

Then what is the ReactiveObject ?

0 Votes 0 ·
Show more comments
ClemensBaumgartner-1819 avatar image
2 Votes"
ClemensBaumgartner-1819 answered ClemensBaumgartner-1819 commented

I have the same issue with Visual Studio for Mac 2019 8.9.1.

System.MissingMethodException: Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`1<byte>)
at System.Text.Json.JsonEncodedText.EncodeHelper (System.ReadOnlySpan`1[T] utf8Value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00000] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonEncodedText.TranscodeAndEncode (System.ReadOnlySpan`1[T] value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00033] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonEncodedText.Encode (System.ReadOnlySpan`1[T] value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00014] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonEncodedText.Encode (System.String value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00014] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol..cctor () [0x00000] in <e9a2179829b545318c48f40308fc4754>:0 } System.MissingMethodException

This happens when I try to initialize an instance of a HubConnectionBuilder from Microsoft.AspNetCore.SignalR.Client. It worked fine with Version 8.8.6 of VS for Mac 2019



· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Please give the code of the HubConnectionBuilder

0 Votes 0 ·

The HubConnectionBuilder is a class of AspNetCore. I use it like this

 HubConnection connection = new HubConnectionBuilder()
             .WithUrl($"http://xyz.com/signalrhub?access_token={AccessToken}")
             .Build();
0 Votes 0 ·
MikaelPlate-3113 avatar image
1 Vote"
MikaelPlate-3113 answered MikaelPlate-3113 commented

Same problem here. Code worked one or two weeks ago (don't work every week in this project). I suspect (not confirmed) that the latest Visual Studio 2019 update to version 8.9.1 caused this since it seems to fit in time. I've now replaced all json serialization and deserialization code with Newtonsoft component (which works) to be able to get a new version out the door.

Method not found: int System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`1<byte>)

Stack trace:
at System.Text.Json.JsonEncodedText.EncodeHelper (System.ReadOnlySpan`1[T] utf8Value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x00000] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonEncodedText.Encode (System.ReadOnlySpan`1[T] utf8Value, System.Text.Encodings.Web.JavaScriptEncoder encoder) [0x0001a] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonPropertyInfo.DeterminePropertyName () [0x000bc] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonPropertyInfo.GetPolicies () [0x00006] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonPropertyInfoCommon`4[TClass,TDeclaredProperty,TRuntimeProperty,TConverter].Initialize (System.Type parentClassType, System.Type declaredPropertyType, System.Type runtimePropertyType, System.Type implementedPropertyType, System.Reflection.PropertyInfo propertyInfo, System.Type elementType, System.Text.Json.Serialization.JsonConverter converter, System.Text.Json.JsonSerializerOptions options) [0x000a3] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonClassInfo.CreateProperty (System.Type declaredPropertyType, System.Type runtimePropertyType, System.Type implementedPropertyType, System.Reflection.PropertyInfo propertyInfo, System.Type parentClassType, System.Text.Json.Serialization.JsonConverter converter, System.Text.Json.JsonSerializerOptions options) [0x00184] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonClassInfo.AddProperty (System.Type propertyType, System.Reflection.PropertyInfo propertyInfo, System.Type classType, System.Text.Json.JsonSerializerOptions options) [0x0002f] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonClassInfo..ctor (System.Type type, System.Text.Json.JsonSerializerOptions options) [0x000d3] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonSerializerOptions.GetOrAddClass (System.Type classType) [0x00017] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.ReadStackFrame.Initialize (System.Type type, System.Text.Json.JsonSerializerOptions options) [0x00000] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonSerializer.ReadCore (System.Type returnType, System.Text.Json.JsonSerializerOptions options, System.Text.Json.Utf8JsonReader& reader) [0x00008] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonSerializer.Deserialize (System.String json, System.Type returnType, System.Text.Json.JsonSerializerOptions options) [0x0009d] in <815ff95f4d6a463fa6a3be490e0514aa>:0
at System.Text.Json.JsonSerializer.Deserialize[TValue] (System.String json, System.Text.Json.JsonSerializerOptions options) [0x00000] in <815ff95f4d6a463fa6a3be490e0514aa>:0

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I found that Newtonsoft does not throw an exception, but the result of the serialization is like [{}, {}, {}, {}, {}] so in the end it doesn't even serialize either...

0 Votes 0 ·

If I remember correctly, Newtonsoft does only serialize properties (and not members). Maybe this is why you are seeing empty objects? You are using members that was serialized by System.Text.Json, but not by Newtonsoft (at least not by default). For my case, they are all public properties and are serialized by Newtonsoft correctly.

0 Votes 0 ·
Stesvis-5434 avatar image
1 Vote"
Stesvis-5434 answered Stesvis-5434 edited

Here is a simple example.
https://github.com/stesvis/SerializationTest

I am trying both serializations, one with System.Text.Json (where it works with or without ReactiveObject) and one with Newtonsoft.
In my real app, System.Text.Json throws the exception, but i can't reproduce it here. Maybe it depends on other packages installed?

Anyway, take this code as a reference:

Json = System.Text.Json.JsonSerializer.Serialize(data, new JsonSerializerOptions()
                {
                    MaxDepth = 0,
                    IgnoreNullValues = true,
                    IgnoreReadOnlyProperties = true,
                    PropertyNameCaseInsensitive = true,
                    IgnoreReadOnlyFields = true,
                    IncludeFields = false,
                    //PropertyNamingPolicy = JsonNamingPolicy.CamelCase
                });
                Json2 = Newtonsoft.Json.JsonConvert.SerializeObject(data, new JsonSerializerSettings()
                {
                    NullValueHandling = NullValueHandling.Ignore,
                    MissingMemberHandling = MissingMemberHandling.Ignore,
                    ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                });


Newtonsoft works only if you remove :ReactiveObject from public partial class BaseDTO : ReactiveObject

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZijianHuang-1923 avatar image
0 Votes"
ZijianHuang-1923 answered

Adding System.Memory and Buffers is not making difference, even after a clean build and installation. And this seems to be a recent break, more exactly a bug.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ChuckGiddens-9838 avatar image
1 Vote"
ChuckGiddens-9838 answered

I have this same issue with Xamarin Android project. I am using RestSharp and it cannot deserilaize some of my objects...works on most but crashes on a couple and cannot fix this issue.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.