applejag/Newtonsoft.Json-for-Unity

Suggestion: Update to 13.0.1

KuraiAndras opened this issue ยท 12 comments

Suggested solution

Update to the 13.0.1 release

https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.1

:) I got the notification from GitHub this morning and already planned on updating. Thanks for making an issue on it, makes it easier for me to track it and for others to see the progress.

It's nothing major changed so I'm confident I can pull the changes and deploy later today. Will get on it after work.

Got stuck.

I'm using mono to build the DLLs in GNU/Linux Docker images instead of using Windows containers, as GNU/Linux containers are way cheaper in CircleCI. But mono does not support C# 9 yet, not even their preview nor nightly builds. (Issue on mono repo: mono/mono#20250)

Newtonsoft.Json 13.0.1 does use some new C# 9 syntax. Nothing major, mostly just taking advantage of the new default generic constraint feature (which is quite poorly documented, but can be found here https://github.com/dotnet/csharplang/blob/main/proposals/csharp-9.0/unconstrained-type-parameter-annotations.md) and can be seen for example here:

https://github.com/jilleJr/Newtonsoft.Json-for-Unity/blob/783a48674dfbbd6d8ce9c514a85860a6363ca139/Src/Newtonsoft.Json/Linq/JContainer.cs#L278

Mono is the only bottleneck right now. The merge went smoothly and the code compiles nicely on Windows. I do not have enough energy to change to compiling the project with Windows Docker images just for this upgrade, when Json .NET 13.0.1 does not bring that much new to the table anyway. I'll continue working on this once there is an update from the mono team. Seems like they're having issues with their CI/CD pipeline though... mono/mono#20930 Hopefully nothing major is up

Any particular reason why is this project using circle ci? Github worklflows are free, and unlimited for public repos.

If that is the only blocking issue, and you would want to migrate there I might be able to assist with it.

Well this fork is older than GitHub Actions, and I haven't felt the need of migrating. I've grown quite fon of their UI, featureset, and docs. If you want to aid then I'll gladly accept it, but I warn you that my build pipeline is not that pretty :P

CircleCI is free as well, though they do have a monthly quota even for open source repos. When I do quite a lot of development on this repo I hit that quota quite quickly. Especially due to the 1 Windows container I'm currently running on each build for some tests.

While I'm sceptical about why it's 100% free without any limits on GitHub, I'm still open for researching new tools.

https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/about-billing-for-github-actions#about-billing-for-github-actions
Actions (workflows/pipelines) are free for public repos, and has a limited number of free runtime minutes when running under private repos.

Yeah, after a second look, I might want to pass on migrating the CI.

Any reason why msbuild/mono is needed? As far as I can see it's just a .net standard dll. Why don't you use .Net 5/ Core 3.1 for it?

It's the .NET Portable build that's dragging me behind. I believe was needed for some Windows store or xbox builds, though I'm not sure anymore. Think I left it in for extra optimization as the .NET Standard build lacks some performance features.

And to be able to run as a complete suite of tests as possible I need the .NET Framework build for some tests.

I've not asserted this in a while. Don't really remember the exact list of reasons.

.NET Core/5 can't build .NET Framework builds AFAIK. That's why I am depending on mono

You can build .NET Framework with .NET 5, no problem, although you will need to update the csproj to the new SDK-stlye format. You can even build UWP apps with .NET 5, althought you have to make quite a few modifications to the project file microsoft/WindowsAppSDK#105

Woa, lit! That I gotta try right away

Yep as you said, .NET Framework build completed with a breeze when using the mcr.microsoft.com/dotnet/sdk:5.0 image instead of docker.io/mono:6.12 image. Though the .NET Portable build failed misurably

/usr/share/dotnet/sdk/5.0.201/Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3644: The reference assemblies for .NETPortable,Version=v0.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/root/repo/Src/Newtonsoft.Json/Newtonsoft.Json.csproj]

Either I drop support for the .NET Portable build or wait for Mono to make their VS 16.9 build. Probably the former, as dropping .NET Portable was a thing upstream Json .NET did anyway for v13.0.1.

Either way I'm going to sleep on it and return to it tomorrow. It's getting late for me.

Yeah, portable is basically deprecated. I doubt anyone using your project will miss it.

You've already seen the news. But the tests passed, and I've done a sanity check of adding the package v13.0.102 to a manual testing Unity project, and it compiled happily.

Feeling so fresh right now to have a wider version range than only 12.0.x. Especially with my new attempts at backporting. Now supporting the full range of 11.0.2 to 13.0.1 :)

Hidden gem with this issue, because it gave me even more motivation in updating. Thanks again! @KuraiAndras <3

Glad I could help :)