Docker.DotNet icon indicating copy to clipboard operation
Docker.DotNet copied to clipboard

Migrate from Newtonsoft.Json to System.Text.Json

Open 0xced opened this issue 1 year ago • 1 comments

Everything is now truly async, no more fake Task.Factory.StartNew async.

0xced avatar Mar 07 '24 16:03 0xced

Also, in commit 6a87013e18ed0f02c9e296a53f1707e538e4780c I improved all the HTTP requests to deserialize the JSON payload directly from the HTTP response stream instead of reading the response as string then deserializing to model objects. This is an improvement in both speed and memory allocations.

0xced avatar Mar 07 '24 17:03 0xced

Also, in commit 6a87013 I improved all the HTTP requests to deserialize the JSON payload directly from the HTTP response stream instead of reading the response as string then deserializing to model objects. This is an improvement in both speed and memory allocations.

Why not just use HttpClientJsonExtensions with source generators?

I'm missing what the added value is for having generic methods with no constraints for making the HTTP requests.

paulomorgado avatar Sep 25 '24 18:09 paulomorgado

Why not just use HttpClientJsonExtensions with source generators?

I don't remember but it was probably because of the dozen of MakeRequestAsync variations that depend on ApiResponseErrorHandlingDelegate which whould have been a way too risky refactoring and also nearly impossible to review.

0xced avatar Sep 25 '24 19:09 0xced