Utf8Json
Utf8Json copied to clipboard
Doesn't work with UWP C# projects.
I have used this to great effect in my WPF C# project but the nuget package doesn't seem to support C# UWP projects.
Is there any chance that this could be fixed?
I can't use this sadly if it only works on some of my projects.
Also MessagePack doesn't work either...
Utf8Json supports .NET Standard 2.0. Currently UWP does not support .NET Standard 2.0. But VS preview may works, please try it and wait for fall creator update(?). https://blogs.msdn.microsoft.com/dotnet/2017/08/25/uwp-net-standard-2-0-preview/
Fair enough and thanks for getting back to me :)
VS 2017 version 15.4 supports .NET Standard 2.0 and UWP. https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes#15.4
I've made UWP project and .NET Standard 2.0 project on Visual Studio 2017 version 15.5.5.6 (Community edition).
.NET Standard 2.0 project simply serialize class object to json like below.
JsonSerializer.ToJsonString(obj)
UWP project get serialization result and display it on window.
It works fine on debug build.
But it throws exception below on release build.
Exception thrown: 'System.MissingMethodException' in Utf8Json.dll Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Exception thrown: 'System.TypeInitializationException' in System.Private.CoreLib.dll Exception thrown: 'System.TypeInitializationException' in System.Private.Interop.dll Unhandled exception at 0x00007FFBEDE980E9 (Windows.UI.Xaml.dll) in UseUtf8jsonInUWP.exe: 0xC000027B: アプリケーション内部例外が発生しました。 (parameters: 0x0000026CB41F6090, 0x0000000000000002).
The complete code is below. https://github.com/freedom8888/UseUtf8jsonInUwp
Same Exception occured when I call JsonSerializer.Deserialize(obj) method. Do you have any idea about the reason?
After I changed property below, release build stopped throwing exception. UWP project property -> Build -> uncheck "Compile with .NET Native tool chain"
I'm not sure about the reason.
Maybe requires code generation for AOT. https://github.com/neuecc/Utf8Json#pre-code-generationunityxamarin-supports
After I changed property below, release build stopped throwing exception. UWP project property -> Build -> uncheck "Compile with .NET Native tool chain"
I'm not sure about the reason.
Thank you very much!! It also works with MsgPackCSharp