Open dlbd opened 9 months ago
Most probably that an answer here is to switch to STJ as it was designed in AOT friendly way.
This might be fixed here? https://github.com/JamesNK/Newtonsoft.Json/pull/2902
Most probably that an answer here is to switch to STJ as it was designed in AOT friendly way.
The mobile app inherited a lot of code from an older WinForms application. Migrating everything to STJ (and making sure nothing else broke) would take some work.
This might be fixed here? https://github.com/JamesNK/Newtonsoft.Json/pull/2902
It might be! I'll test after 13.0.4 is released.
13.0.4? #2902 was merged more than 2 years ago.
13.0.4? https://github.com/JamesNK/Newtonsoft.Json/pull/2902 was merged more than 2 years ago.
For me it shows that #2902 was merged on Sep 21, 2023
My bad.
ExpressionValueProvider
does not work on iOS in AOT-only mode and throws exceptions likeSystem.AggregateException: Attempting to JIT compile method '(wrapper delegate-invoke) void <Module>:invoke_callvirt_void_Account_TimingEnum (COMPANY_NAME.Account,COMPANY_NAME.Enums.TimingEnum)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
ReflectionValueProvider
works. But, there is no easy way to switch the entire app fromExpressionValueProvider
toReflectionValueProvider
. Currently as a workaround we are creating custom contract resolversand then using the custom contract resolvers in the app itself, SignalR, RestSharp and other libraries (which all require separate configuration).
Please do one of the following: 1) Provide a centralized way to disable
ExpressionValueProvider
, something likeDefaultContractResolver.DisableExpressionValueProvider = true
. 2) Enable theDynamicCodeGeneration
check insideDefaultContractResolver.CreateMemberValueProvider
(which is also supposed to detect thatExpressionValueProvider
won't work) innetstandard2.0
andnet6.0
builds of Newtonsoft.Json, and perhaps makeJsonTypeReflector.DynamicCodeGeneration
settable.